My original proposal was to change the signature of getId() to getId( $wikiId = false ), to assert that the PageIdentity actually belongs to the wiki the caller expects.
I made a patch exploring that option: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/650126.
It's much simpler, but it relies on runtime assertions rather than type hints.--
Daniel Kinzler Principal Software Engineer, Core Platform Wikimedia Foundation