Typically makes sense to fire anyone who wrote the broken version too, just to get a fresh set of eyes on it.
Not sure why there’s any non-performant or unmaintainable code in light of this fact.
To your analogy, it's possible to incrementally improve a code base. It's also possible to stop it getting worse.
So too do prison guards and their unions.
You would be hard pressed to find a union that represents prison guards which has supported ANY kind of political reform to laws. Legalization, even changes to traffic laws, prison guard unions and their members almost exclusively vote against.
Just for two examples.
No one disagrees with doing that. They might disagree on what "better" means, and in particular better for whom. But 95%+ of the disagreement on these is not because one side is evil and the other is not.