I don’t know about Mystery Gift but you can reset for the stats for the legendaries in the actual game. Although this requires a little setup.
1. Heal at a pokecenter(this is considered a safe state by the game and it generates a backup save)
2. Catch the legendary, which usually results in an auto save
3. If the Pokemon has undesirable stats, exit to the main menu, press Up+B+X, you get the option to load your backup save and not your last autosave
4. Rinse and repeat
This works for a lot of stuff, like if you want to see different outcomes for sidequests and the like too. The purpose of the feature is to have a safe state in case you break something in the game and the game auto saves over it, but it can also be used for other kinds of resetting given how aggressive the autosave is in this game.
That said I don’t know exactly all the circumstances for when the game generates these backup saves, it is possible receiving a Mystery Gift would generate one and make resetting this way unviable.