See @Pierre's answer for the market part.
The part that matters these days is simple.
- Programmers can be outsourced cheaply.
- Migrant worker visas allow companies to pay uncompetitive salaries
- The work is more complex than it used to be
- The glut of kids who grew up with 8 bit machines dried up. The 8 bit machines were comprehensible to kids (and adults); there's practically no operating system and there's always a BASIC interpreter and an assembler..
So these days,
- study hard for 4 years for a software engineering degree
- Maybe get hired and get paid 45k. (Pay hasn't kept up with inflation over the last decade.)
Software engineering ( at least when I studied it) had the worst pass rates on campus.
Students can get on the internet (anywhere in the world) and see professional programmers discussing pay and conditions. There's a lot less wide-eyed innocence going around about jobs.
So the pay is for beans, people hate you ( my wife tells me people hate software engineers, because we make everyone feel powerless) Why would people do this again ?
Whenever people start talking about "only the people that really love the job do it now" what they really mean is that only the suckers are buying.
The ACM and other groups have been holding an outreach to minorities over the last decade. When you try extra to get minorities into your profession, there's someone out back looking forward to offering even lower pay and worse conditions.
Back when programming had a lot more women, in the 60's and 70's, working conditions were much better. Women got out around the time all the microcomputer "programmers" arrived on the market. Maybe we have met the enemy, and he is us.
(Me, I do it because programming is the only job I know.)