The game stores two sets of Friendship/Memories; one for the Original Trainer, and one for the latest (not OT) Handling Trainer. A Pokemon will now always remember its first trainer, and will remember the last trainer that had possession of it.
The pkm format stores a 0 or 1 to point to which values should be used: 0 = OT, 1 = HT.
Since the OT info is for a different game (different version), it should never be 0 if it is transferred to a future format. The OT values are forever frozen, and never to be modified. PKHeX also uses this restriction for memories; a past gen PKM can never make a memory with the OT as memories did not exist while it was with its OT.
99.9999% of the time, a similar ID/SID/OT is due to hacking, thus it should be flagged. I am not aware of anyone who has RNG'd their ID/OT to match a past game ID, but have encountered specimens that can be flagged with this logic.
Change the OT/ID info to something that does not match your current save file, then make yourself the handling trainer (HT name text). Rather, just let PKHeX set that for you (which it does automatically).