For a UserIdentity constructed from a revision row loaded from the database of another wiki, the user ID (and actor ID) must be ignored and forced to be 0. To find the relevant code, search for calls to $user = User::newFromAnyId() in RevisionStore. These calls must have the user ID and actor ID suppressed if $this->wikiId is not false.
This is a stop-gap solution for the problem described in T222212: RevisionStore must not expose user IDs from a foreign wiki.
A more thorough solution will need T222380: Decide how to represent the identity of users from another wiki..