Even if developers were able to objectively asses that code is hard to maintain/extend/debug, that doesn't mean changing it is the right business decision. It may or may not be. From a pure efficiency standpoint, it may well be a net loss. From a developer psychology standpoint, it may be worthwhile.
You also can do a lot of refactoring without breaking a lot of code, especially if you didn't buy into the idea of writing tiny functions and unit tests for every piece of functionality.
Most of the code I refactor is my own from a few years ago, btw. Usually because I learned new information, past choices turned out to have regrettable unforeseen consequences, etc.
But we have learned to be really careful about public APIs. Implementations may change, interfaces are forever.
I didn't say that.
> Usually because I learned new information, past choices turned out to have regrettable unforeseen consequences, etc.
Indeed, that "awful" code may have been written by the same developer from one or two years ago and now they're not comfortable with it anymore either.
Of course I'm being a bit hyperbolic, but what I'm saying is basically true and applies to pretty much everyone.
It's not all bad either, without some push towards renewal, we would be stuck with old ideas forever. The key point is that permanent renewal has a cost that the business must carry. Sometimes no renewal at all is the right business decision.
The tragedy is mandatory, all-out migration for code that was already high quality, and just happened to be written for an older stack.