I'll add some more comments even though I expect to get downvoted for pointing out some things that seem obvious to me.
We all have to take control of our careers. Blaming bogeymen like "AI" or "foreign cheap labor" (offshoring), or how recruiters and HR people don't understand tech, or how companies don't know how to interview and hire just marks a person as not in charge of their career choices.
People who can learn, participate in a team and organization, and add business value will always have good job prospects. That has little to do with specific tech trends (languages, frameworks) or gamification like leetcode or public side projects. Programmers have over time turned the software industry into a self-referential cult, where the business that pays salaries gets ignored or mocked ("I just want to code, don't make me go to meetings." "I don't want to watch actual users on the site."). Programmers waste enormous resources on new tools, languages, frameworks, fads and fashion, very little of which pays off in terms of adding business value. Even senior-ish developers with 5+ years complain they have no professional contacts when they get laid off, and expect LinkedIn to somehow make up for that because a cool mechanical keyboard or dark mode on a blog took priority back when it mattered.
The low interest rate over-hiring bubble that created a lot of companies with low and negative profits has come to an end, for now. Companies adjusted with layoffs and demands for actual productivity that shows up as profits. This is my third or fourth downturn in tech. I learned after the first one (also an offshoring scare back in the '80s) to focus on fundamental skills, cultivate an actual professional network and friends (not on sites like LinkedIn), and pay as much attention to business domain expertise as to technical skills. More than half of what I have learned in almost 40 years programming has faded into history, obsolete or another blip on the endless parade of fad and fashion the industry pretends represents progress.