Earth's magnetic field follows the flow of magma inside Earth (not the solid iron core). There would not be any pole reversals if the magnetic field was created by something constant like the distribution of molecules in Earth's atmosphere.
https://www.nasa.gov/topics/earth/features/2012-poleReversal...