Spaces disappear (but not their application windows) when I unplug external monitors
@vykor pointed me in the right direction: the behavior I was seeing is a side effect of the "Displays have separate Spaces" setting.


Why do Spaces disappear when I unplug external monitors, and how do I stop it from happening?


Why: because displays have separate Spaces, which means when there are fewer displays there are fewer Spaces. (One of those things that's obvious in retrospect.) 
How to stop it: unchecking the "Displays have separate Spaces" setting does stop Spaces from disappearing, but the new behavior isn't any better for my needs: windows end up jumbled up on a single monitor when I reconnect the monitors, and all screens cycle through Spaces in unison making it hard to make good use of the screen real estate.

How can I get Spaces to return to the same monitors they were on before, when I plug those monitors back in?


There doesn't seem to be a built-in way to do this, so the answer here seems to be to install a window management app such as Stay.



I've turned "Displays have separate Spaces" back on, and I'm setting up Stay to have a configuration for the laptop display alone and for the three monitor setup, so that I can quickly restore my windows to my desired arrangement in either situation. I'm still working the kinks out with Stay, but I think that's going to be a good solution.