Recovery of struggling large settlements (1-6k)
At some point of development of most of my settlements, with maybe one Amevian / Lizardkin exception (I sometimes play with Classic Races), the settlement starts to collapse.
For a long time, I manage to maintain the population happy and loyal enough, but as it grows it's more and more on the edge. Then, a single major disturbance (loss of an army, running out of money in a costly war etc) sort of tips the scale and the collapse begins. Science, knowledge and administration all drop like crazy so I lose techs to support my economy and facilities. I'll gradually have a bigger and bigger shortage of workforce, I can downscale non-critical industries or services but ultimately it only makes the collapse take more time.
Then, I tried recovering from between 50% and 90% peak population loss (sometimes under 100 citizens) and it almost never worked. At some point everything is degraded, the upgraded structures cannot be maintained anymore, everyone's unhappy even if they're fed etc.
Should I just demolish half of my city, and downgrade the other half?
How do you recover from this without essentially building from scratch?