I see all your issues and don't have any answers.
But I do have some contribution to my experience with Update pages.
I know that on the update pages if I don't move the lower level php for connection to the top, update always fails. There are two php lines that really need to go to the top of the page. I have to do it all the time for all my database updates pages. Always.
And, Ray has taught me not to have any empty spaces when closing up the php code.
As far as my method of which pages to create first I do:
Insert
Update
Details
Results
Not sure any of this helps but an insight as to what I have tried to deal with.
HTH or at least contributes to this discussion.
A related thread here: https://webassist.com/forums/posts.php?id=46039