The aufbau principle is not a fundamental law of physics. It only holds for atoms for which a self consistent field description of the one-electron states is sufficiently accurate and leads to a central potential which differs not too much from the form Z_eff/r. However, in actual atoms, there is a continuous transition from a Z/r like behaviour very near the nucleus, where there are no other electrons to shield the nuclear charge Z, and 1/r at large distances, where all other Z-1 electrons shield the nuclear charge Z. This r-dependent shielding of nuclear charge can be roughly described by a potential of the form Z_eff/r+a/r^2. The additional term has the effect to split the levels of different angular momentum which for a pure Z_eff/r potential would be degenerate. Hence ultimately the orbitals of high angular momentum and quantum number n overtake the states of low angular momentum with radial quantum number n+1.