In 25 years...
Thing is, IT has always been this way...it's not generally a long term career for most people. Most people duck out at the 10 year mark for one reason or another...usually because tech is a dead end for them and they can't really progress anymore or they move into tech adjacent roles which aren't really tech anymore...like project management etc...which earns a lot less money than people think when they make the jump.
...I have never been out of work even once. When this sort of thing happens it's people in the middle that disappear from the industry. Because it's the folks in the middle that are the easiest to remove / replace with something else...I started my career early (I was out and about as a field engineer when I was 19 whilst most of my mates who I did computing with in college were at Uni, prior to that, from about 15 years old, I was doing local IT support around my area, undercutting PC World and doing a better job).
Juniors (just starting) and Seniors are generally, quite safe depending on their age and relative experience....it's mostly because you can't really get by without senior techies and junior techies are cheap, especially the very young ones...the guys in the middle though...not as cheap as juniors and usually not as experienced or skilled as the senior techies.
I've always said to people wanting to embark on a career in tech...start early...no matter what, you're going to start out in a shit paid position that you hate...so you might as well get it out the way when you're 19-24 and you don't have any debts, massive expenses etc....this way, you'll have 5-6 years experience when the folks in your age group at Uni hit the job market and they will always be behind you as a nice cushion when layoffs come around in your late twenties / early thirties...because you will be a known quantity with a decade of experience (you are now senior) whilst the others are still "middlers" with 5 years of experience or less and older than the younger, cheaper rookies.
I read some statistics somewhere recently, unfortunately I can't find the link...but according to those stats, something like 55% of people working in tech have 9 years or less experience. More or less an equal distribution between juniors (1-5 years) and middlers (5-9 years). There is a sharp drop off at 10-14 years experience (18%) then by the time you reach 25-29 years experience (where I am), it drops to around 5%.
These are quite shocking stats, because they suggest that within 10 years of starting, half of the people that enter tech will be gone and will never return.
I don't know the age ranges in these experience brackets, but I'd imagine the majority of the folks still around in the 25-29 year experience bracket, are probably in their 40s...I certainly don't come across many folks in their 50s with my years of experience. It's kind of a weird place where I am...pretty much all of the folks I started out my career with are long gone from the industry, most of the folks I work with my age have a similar background to me (started early, no uni) and the folks that are better qualified (and usually older than me) usually have about half the experience, earn considerably less and find themselves with pockets of unemployment because they are hyper-specialised.
The other common pattern is the ones that stick around are the ones that jump into freelancing / consulting. The vast majority of the folks I know in tech that have been around for a long time, at some point converted their permie role into a freelance role and started branching out to new clients...you typically do this by negotiating with your employer to work reduced hours (usually 50%) for a reduced pay packet (usually 75%) which frees you up to put eggs in different baskets. By the time you reach about 4 or 5 clients, it's pretty difficult to become "unemployed" unless you end up with some nasty disease or horrendous injury etc...especially if you spread your load across different industries rather than focusing on one specific industry...because when times are hard in one industry, you will have the flexibility to reduce your rates to keep the client, whilst raising them for a company in an industry doing well to counter it. Drop 20% on one client, then increase by 5% everywhere else (if you even want to keep the client at all).