Oops, it's been a long day. I re-checked and indeed you are correct; your "real" Magikarp do show as Route 4.
I verified on my own copy by obtaining a Magikarp, and they have the Met Location of [104], that of Route 4, not [99] for the Pokémon Center. I have pushed a fix so that the encounter is tagged with the correct met location ID. https://github.com/kwsch/PKHeX/commit/538374b33fb640f127628ee1dd0c1be82ac534b3
The program currently searches through the static encounters first; in Gen4 it's not comparing the met location (since it was changed), so it matched the static encounter first. In Gen3, it was comparing the met location to the template's 99, which didn't match, and it eventually landed on the encounter slot as the "first" adequate match. With the ^ fix, Gen3 will now recognize it as a static encounter.
Conversely, what if you caught it via Old Rod Fishing? Well, it matches the details of the gift too, and the gift is checked first, so that would be why the reverse would have the "unexpected" result.