I think the real problem is that we don't call the first 5--10 years of a developer's career for what they really are: an apprenticeship.
A lot of companies hire what are effectively a team of apprentices and hope that they will somehow figure things out as they go. They tend to learn a lot of bad habits from each other. They will make you money, because even a small amount of programming skill can earn you money in the short run, but their code will eventually collapse under its own gravity and need to be rewritten.
Apprentices need to be paired with journeymen to learn the craft. I have not met a single successful team that has not had at least as many journeymen as apprentices -- ideally even more.
----
This is incidentally also my issue with the leagues of consultants who have only ever done greenfield or nearly greenfield stuff. They learn to write stuff in a way that it's completed quickly and lasts maybe a small number of years. That's what they are rewarded for, so obviously that's what they will get good at.
The people I've met who are really good developers are those that also have followed a product from initial design throughout its lifecycle into decommissioning. They seem to have a more holistic picture of the factors involved in making stuff.