The poles don’t swap ends. Those graphics they show you don’t really exist. It’s all statistical, non-observed claptrap.
Paleomagnetics finds stripes of opposing magnetic polarity in seafloor spreading regions, leading some to the conclusion that the magnetic field was in a particular direction when the rock hardened. You see the same thing in some volcanic deposits.
In the lab, you can melt basalt, expose it to a mag field, and then cool it. The imposed field will be locked in.
This sort of thing, an observation in nature backed up with empirical data taken under controlled conditions, fools a lot of people.