I've watched dozens of people try to learn to code and fail, some definitely not for a lack of trying. Of those that did learn, only a fraction had the IQ or passion to be genuinely good at it.
The difficulty of it has absolutely been a bottleneck to the supply of good devs, keeping salaries high.