I recently found out about that trick where you change your DNS settings on your DS to get old mystery gifts in gen 4 and 5, and I was wondering if Pokémon from those "legal" and if they are safe to bring to Pokémon Home (and also will it break Pokémon Home if I do it?)
As someone who's transferred those Pokemon up through Gen 8, yes, they are legal. The Pokemon you receive are the exact same Pokemon that were actually distributed back from 2006-2013. Whether these Pokemon are "illegitimate" is up for you to decide. But they will not mess with your Pokemon Home, and you can transfer the Pokemon into any game that the Pokemon is available in.
Backup sources: Source Source
Hope I could help!