The documentation of Content::prepareSave() currently states:
This may be used to check the content's consistency with global state. This function should
NOT write any information to the database.
Note that this method will usually be called inside the same transaction
bracket that will be used to save the new revision.
This implies that prepareSave() may check that some aspect of the page content is globally unique, and can prevent the revision from being saved if this is not the case. Wikibase currently uses this to enforce uniqueness of sitelinks.
MediaWiki's behavior is currently inconsistent with respect to this: when undeleting, prepareSave() is called for the latest restorable row, preventing undeletion of pages if they would cause an inconsistency. However, no such check is performed by ImportableOldRevisionImporter when importing revisions.
Observation: strong guarantees about global consistency are not consistently enforced, and are hard to reconcile with undeletion and import, and seem incompatible with the wiki way of working.
Proposal: only call prepareSave() for explicit edits (via UI or API), but not for undeletion, import, or other programmatic creation of revisions. This still allows constraints to be enforced for user edits, while removing the risk of preventing undeletion due to conflicts. This technically doesn't weaken any guarantees, since prepareSave() was never calls during import. This adjustment firs well with the refactoring work for T174038: Initial implementation of MCR page update interface.