Try saving once in PKHeX.
What do you mean with that? Going to File > Export SAV?
When you use the save manager to restore the save into the 3DS, make sure it's named "main" (with no extensions) in the folder, and there's nothing else in the folder.
That's what i am doing, i use Checkpoint for dumps/restores save files and my setup is 3ds/checkpoint/saves/0x01B50 Pokémon Ultra Sun/NameOfTheSave/main (with no extensions)
I also tried removing/legalizing some of the illegal Pokémon, but that doesn't work either.