This is worked around in https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/502150/ (see related T220316) but the underlying issue needs to be fixed.
In the present case, one page is Commons:Deletion_requests/Files_uploaded_by_Nabila.selim in the main namespace (0), the other page is in the Commons namespace with title Deletion_requests/Files_uploaded_by_Nabila.selim, they have close page ids and so are read in the same batch query for xml stubs. Both have the same key in the link cache for lookup.
Unlike the related bug, neither page is a redirect but when the first revision of the second page is to be written, eventually the constructor invokes Title:getArticleID which goes to retrieve the info for the title from the link cache, which is for the other title with its page id, causing an exception again at RevisionStoreRecord.php
InvalidArgumentException from line 100 of /srv/mediawiki_atg/php-1.33.0-wmf.23/includes/Revision/RevisionStoreRecord.php: The given Title does not belong to page ID 38058998 but actually belongs to 38058985
We need either to clean up these bad pages/revisions manually in some fashion or to do something with them so that they don't live at these unreachable titles.