I don't think programming is much different than any other endeavour. Talent will bring you a long way, but requires practice and training to get you to the point where you are good (or better than good).
People with average talent can become quite good, but just like everything else, they won't be able to catch the more talented person who puts in as much effort and receives as much coaching.
However, if you look at things like sports, the margins are really fine. A 2 minute margin of victory in the Tour de France represents less than 1% of the total time in the race. People at the top end of sports have the best training, the best coaching and the best talent because 1% is the difference between winning the championship game and not even making the team.
The margins in programming are huge in comparison. Someone with average talent who has good coaching and works hard in a consistent way will be so much better than your average developer that I think talent barely works into the equation. Just like everything, the super talented are rare, but in our field it doesn't matter because we can potentially train people to be much more than "good enough".
You have hit the nail on the head, though, with respect to the problem. Training is a cost centre. Let's say you take a person right out of a boot camp -- they can write code, but have only a couple months of practice under their belts. While they can improve dramatically over a year or two, it's still going to take 5 years or more for them to hit the "much more than good enough" level. If you want them to be able to handle the nuances of making sure a project is successful, you need at least another 5 years on top of that.
People change jobs every 2-3 years on average. You are just starting to see some payback on your investment and they are gone. Even worse, investing in training costs you more than buying talent. If you spend time and money (and factor in the cost of lost opportunity by hiring people who are still learning their craft), when they reach the level of a more experience/talented individual they want the same pay!
So you can pay double for someone talented who has 5-10 years of experience, or you can try to train someone up to that level. After 5 years, they still want double (if they are even still around), even though you have invested in them.
This is why the top teams are willing to spend ridiculous money (2x the median) on top people and are unwilling to train anyone. The teams who aren't willing to pay top dollar also are unwilling to pay for training. They think they can get twice as many people if they pay half as much and will get more done. They aren't interested in paying for increased skill.
Unlike sports, 1% difference in ability has virtually no meaning in programming. This means we don't need to scour the world for the best young programmers and build a world class training program for them. At best, we pay double for people who have the talent and/or experience to be "much better than average".
It's broken, but I don't know how you can fix it.