So what's the lesson here? Aggressively remove old features, as you suggest? Rewrite everything every few years? Software has become way too complex to closely audit everything forever...
It is very educative to read about security models on Multitics, ClearPath, System 360/370, OS/400 among many other similar systems, their attack vectors, and what we ended up getting by having winner takes it all with UNIX based systems.
This year we celebrated 30 years of Morris worm.
Wow. That was one hell of a night. Melted down our university computer labs, packed with desperate undergrads trying to complete and turn in their projects before midnight deadline...
How did admins manage to disinfect servers? It should have been a hell of fun for them, provided it was the first pandemic ever.
Hard reboot with email server disabled.
Shellshock comes to mind.
I'm very surprised this hasn't been done a decade ago.