Young folks aren't in a position to do much about it. They're deeply indebted and need the job.
Many old folks can't do much about it either. They're also deeply indebted and need the job.
I think you'll find the young folks aren't the ones making these decisions. It's primarily equally old rich folks and their institutional shareholders, which are often large pension funds.
Personally (early 30s) this stresses me out almost every day. Just the anxiety of knowing in 10 years time I will be on the chopping block daily, regardless of how good I am. And frankly my generation has ridiculous education and housing debt so we're going to have it a lot worse than you - sorry to use the obligatory term - boomers.
"In 10 years time I will be on the chopping block daily"
That's a pretty maximal-fear approach to take. In my 30s I was afraid of lack of steady income, but the idea that you'll be washed up without an income as a software developer is a lie your fear is telling you. But there will be gaps in employment for various reasons, so expect that. It's not a problem, just make sure you have six months or so of cash like they say, although the longest I've gone without a job is four months, and that was in the .com bust. Also, know your worth. What does a developer with 10, 20, 30 years of experience bring to the table? Find places that need that. I've found contract work to be really helpful in getting perspective. As a contract worker, I am essentially selling the ability to solve your problem (doesn't matter what environment or language, although I'll be faster in ones I know), and as a contractor, I am selling disposability. You don't want me for whatever reason, no problem, it's been a pleasure, let me know if you need anything in the future. (Of course, my rates are priced accordingly.) Full-time employees are selling something a little different, like reliable future availability. Companies aren't out looking every day for who they can fire (if you're at one that is, quit), they are desperately trying to get things implemented because their imagination exceeds their development capacity. If your company doesn't value you or what you bring, find one that does. There are lots of companies out there needing an incredibly diverse set of problems solved. One of my early clients needed to analyze some PostScript code; I got the job because I'd dabbled in writing PostScript back around the time it came out so I could claim some experience. That's pretty obscure! There are lots of jobs out there, and I guarantee that if you are competent, there are multiple companies out there that find your experience is just perfect for what they need.