Why do PES graphs list 4s after 3d? Coming straight off of some electron configuration worksheets, our teacher started to teach us how to read photoelectron spectroscopy (PES) graphs and I'm having a bit of trouble with the two.
During the previous lecture on electron configuration, we were told that electrons occupied the most stable energy level available. That came in this order: 1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, etc.

But then, during the photoelectron spectroscopy lecture, we were told that the 3d electrons have higher ionization energy than the 4s electrons and, in fact, that this pattern continues, just counting up the orbitals: 1s, 2s, 2p, 3s, 3p, 3d, 4s, 4p, 4d, 4f, etc.

Why do electrons fill orbitals in the former pattern, but leave orbitals in the latter pattern?
Why would the 4s orbital fill before the 3d if it is less tightly held by the nucleus, and thus less stable?
I assume I have been taught some simplified versions and my teacher has my interests at heart, but I'm a bit confused.
For a given atomic kernel, the orbitals energies are not fixed like a set of shelves. Their energy depends on filling themselves and also on filling the other orbitals by electrons, because of kernel shielding and mutual repulsion.
The mutual energy is $4\mathrm{s} \lt 3\mathrm{d}$ when empty. But as kernel charge gets increased and $\mathrm{4s}$ and then $\mathrm{3d}$ are being filled, their energy order gets switched.
The typical case is the 3d energy drop $\ce{K -&gt; Ca -&gt; Sc}$, where the order is:
$$\mathrm{K: 4s \lt 4p \lt 3d}$$
$$\mathrm{Ca: 4s \lt 3d \lt 4p}$$
$$\mathrm{Sc: 3d \lt 4s \lt 4p}$$
well described on  charts in SE Chemistry Q what-is-d-orbital-collapse, which are related to the effective kernel charge acting upon electrons on various orbitals.