1) Um, maybe, I don't really know what you mean by "unlegit Pokemon game" because if its not an official Pokemon game I don't think it would be able to use Online matchup.
2) No, just the Pokemon is the only thing that's hacked. Your game is fine.
Do you mean an unlegit game = a game that was modified by codes? If it's just simple codes like All Berries, All Medicines, All Pokeballs, etc, it doesn't make your game or the Pokemon unlegit, because you'd just be feeding it berries, using the Pokeballs, etc, you won't actually be modifying parts of your game (making Events happen when you don't have the requirement) or going to places you shouldn't (walk through walls code specifically). So the berries aren't unlegit, the Pokemon isn't, the game isn't. You shouldn't have to trade the Pokemon, feed berries, then trade it back to your "legit" game.
The only time a Pokemon isn't legit is when you force the game to generate something that wouldn't occur naturally: forcing a Pokemon to be shiny, forcing a Pokemon to appear where it isn't normally found, changing the gender, editing the level, moves that it shouldn't learn normally, etc.
I hope I explained this well enough!