It's exactly same as arguing you should not educate your workers. Cause they might leave. So you get only the least knowledgeable ones.
Software solves business problems. Code that meets its requirements needs to be left alone. Developers just changing code because they feel like it need some coaching. They're wasting everybody's time for reasons that amount to "I like it My Way".
So, with normally performing developers, the only code that changes is the code that needs to change. Good or bad only has an influence on the cost of a change.
Nothing to do with "just changing code because they feel like it".
There is nothing that makes good code more or less likely to change than bad code.
Sounds like the 'bad currency drives good currency out of circulation' problem. Bad code drives good code out, because good code is easy to understand and change.
I call this the Peter Principle of Programming:
"Code increases in complication to the first level where it is too complicated to understand. It then hovers around this level of complexity as developers fear to touch it, pecking away here and there to add needed features."
I will highlight though that I have worked with people that choose the path of least resistance regardless of complexity of the code that would need to be changed. It's as if they refuse to read code.
Template meta programming is an entirely separate, incredibly complex, programming language distinct from c++. The only people I have ever seen use it in production are exceptionally skilled programmers. Everyone else flees and cowers. If they try to change it it will not compile. So why is this good? Because it only allows the framework to be extended in the ways intended by the original designer. Anyone wanting to update this unholy beast will be a master programmer who’s investing significant effort. That implies the updates will be good.
Good code is easy to change. Great code is near impossible to change, but easy to extend.
In such a code base, it quickly becomes understood that if changes are required to “framework Doom” in order to achieve a new feature, the time budget will need to be large. It’s built in tech-debt prevention.
Premature generalization is a well known problem and a never-ending source of complexity. I lost count of the times I had to push back on PRs of clueless developers who felt the need to generalize one-liners that pop up twice in the whole project, and for that their proposal was to add a strategy pattern, ultimate replacing two expressions with three classes.
https://nigeltao.github.io/blog/2021/json-with-commas-commen...
Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated.
That's the danger; good code is easy to change so it will easily get rewritten until it's not easy to change anymore.