The association is required in every area I know of to save for exactly those contingencies. A new roof, barring a tree falls on the building, or a plane crashing into it should NOT trigger a special assessment.
Special assessments should be for things that are unpredictable - improper construction of something (with the construction firm being impossible to sue for whatever reason), unexpected settling of a foundation, a bad storm causes unexpected damage, etc.
Roofs have predictable lifespans and should be getting inspected regularly. Most of the time, you can glance at it from the street and tell if it will need replacement shortly - missing tiles/shingles/shakes, any peeling/curling, missing/faded 'grit' on asphalt shingles, rot in an eave, etc.
A unexpected and large roof bill is almost always a sign of negligent or incompetent maintenance and bad administration.
What causes these problems is the thinking that it isn't inevitable, and no one wanting to pay/set aside the extra $125/mo over the prior 20-50 years to be prepared when it happens. Which is often exactly the folks you are talking about who plan on leaving before it happens, and the associations which let it happen, even though it's negligent for the condo association managers and board.
Even easier if inflation lets them just not raise HOA fees ever, and the same thing happens.
ALWAYS check reserves before buying a condo. ALWAYS check bylaws. ALWAYS check projected lifespans and expected maintenance projects of the condo association. ALWAYS get your own inspections.
Here in CA they are required by law to disclose them, though they often make it a bit of an expensive hassle to get them if you aren't already an owner. Still better than getting stuck with a huge $100k+ special assessment.
The harder they make it, the more you should walk away from a place. It's rare someone will make it hard if it's all sunshine, rainbows, and good management.