It's possible to protect against heatwaves on a city level. Increase the albedo value of the city by doing the following: Incentivize lighter colored roofing and walls, grow leafy trees for shade, cover parking lots with solar roofing (and add EV chargers). Basically do whatever possible to reduce the amount of asphalt and darkish materials in general, being hit by sunshine.
No it won't save your ass when ambient temperature is 50C, but considering that cities are by their very nature hotter than the ambient temperature out side of the city, these things would help reduce that gap.
For detached houses, you can do split systems with multiple indoor units per one outdoor unit. In a flat, you're a bit more fucked because you might need permission from other people in the building, etc.