I noticed while testing something else on patchdemo that the order of new page creations was wrong, and figured out that we are currently overwriting the revid and old_revid for new page creations with 0 instead of using the real values that exist (originally I added the setting to 0 because I didn't realize that the values were already there during T257428: Refactor utils to avoid duplicate rows for new pages with edits)
I originally thought it was because the logic to sort edits uses timestamps and we are truncating the timestamps before sorting, but that falls back the rev id and thus the problem above; both should be fixed.