When we create the list of revisions it is not always in order. We manually publish the pdf and adjust the table accordingly, by looking at the pdf to see what the page number is. Looking for a better method.
My thoughts are either have a script that when the document is open it checks the xrefs in the first column against the ditamap, and copy's and pastes the row in a new table at the bottom of the document in the correct order.
Or a script were have to publish the pdf once to get the page number, enter it in a comment.
This sounds like generating a List of Effective Pages (LoEP) for a technical publication? Arbortext Change Page Application (CPA) was a product - no longer available - that did this and more for MILSPEC publications. You can create your own but it may take some effort. Basically it is as you say, you have to first format the pages out to get the final page numbering for each section of the publication. You would then create the LoEP PDF using that data, and finally join the LoEP PDF with its source publication via a PDF merge operation. I know the details of how we would do this with APP print engine, but not with FOSI.