The real, underlying problem is that an inexperienced or mediocre developer is typically the most expensive person on the team. Not only is their salary disproportionately high compared to the higher productivity folks on the team (I can pay someone $60k/year right out of college or $90k or $100k as a senior in my area and if this was a linear scale either that junior would be $20/hour or the senior would be $300k...), but they consume massive amounts of the team's time to catch up to speed, help them troubleshoot, explain requirements more carefully, and so on.
Investing in junior developers is definitely a "prisoner's dilemma" situation. What's good for the labor market on the whole (taking in less-experienced folks and helping them get skilled up) is terrible for the individual orgs, and vice versa. Do you sometimes find diamonds in the rough and get to be the one polishing them? Sure do. I've done it plenty of times. But having gone down that road I can say that it is extremely difficult and expensive unless you are a "destination employer" and have a ton of patience and energy.
Not that only hiring seniors is guaranteed to be better, of course. There are tons of people with 1 year experience repeated 10 times, people with great resumes and who interview well and are pretty terrible. And there are juniors out there who are rockstars on Day 1. But you are more likely to get a decent senior, a lot of the weedout has already occurred, you can see who has been on tough projects where their skills were improved and who has been coasting and not improving, and so on.
Until either the salary scale recalibrates so that pay is roughly aligned to quality, or there is a really good system in place to ensure that the juniors are much higher quality than they are now, this is going to be a thing.
J.Ja