Rapid geomagnetic variations and stable stratification at the top of Earth’s core