Very related:
At what stage of basic furniture making should I "finish" the wood?
Should I finish before, during, or after assembly?
The second thread was marked as a duplicate of the one above it but its Answers give much further info so well worth reading both.
It seems intuitive that sanding something before assembling it would be considerably easier
Yes, often it is much easier to smooth wood before assembly. Ditto finish it as you can see from the above threads.
yet, all the instructions I see for woodworking have sanding as the second last step (before finishing).
This could be partly due to bad instructions as you're thinking. Sadly there are loads of poor or outright bad how-tos online on any subject you care to name.
It could though be partly a case of extrapolating from specific projects and thinking it applies more widely, as actually it's not uncommon to pre-sand certain pieces or some surfaces of individual component prior to using them or installing them, precisely because it is hard (or impossible) to do it after assembly.
As wood is very frequently smoothed and made ready for finish by sanding these days boards prepared for shelving for example are usually sanded prior to assembly, possibly leaving a little touch-up sanding to the end after assembly but sometimes not even that (it is better not to have to if you can manage it).
Point of note: you don't have to sand to complete the preparation of wood. Often it can be prepared for finish by hand planing or by scraping (usually in less time and always with less dust produced). See What are the differences between sanding and scraping? for more.