The first javascript is a simple toolbox computation that gets shown properly on the page in a text box, but the value will only be captured in the DB only after the second submit whilst staying on the page. If I navigate away and come back to the page, the first submit never seem to trigger the javascript.
What may be happening is the value is being published after the workflow is ran. Try splitting the workflow into two separate workflows.
On your javascript to bubble element, check the trigger event checkbox. Add a new workflow for when a javascript to bubble event is triggered. In that workflow do your save to database action.
This will ensure the code is ran before the workflow is triggered.