That's a rather SV-centric view. Otherwise 5-10 years (or longer) is quite normal, including in tech. At many companies, a bunch of 3 year stints for a job candidate is something of a red flag.
Trust me, it isn't. It's valid for every organization I've ever been in or consulted for (15+). I am in Eastern Europe and spent 9-10 years in offices, and the other 7 after that it has been all remote. I've seen a lot of companies for both consulting and normal 5-to-9 work.
While the reasons why most people don't stick around above 2-3 years are many and varied (and some are frankly quite stupid) to me it does seem to be the norm.
But I'll readily admit we all live in our own bubbles and confirmation biases. So I'm just sharing an additional anecdote here.
3-5 years is a pretty long stretch in this industry. The longest I’ve ever held a job is just barely 5 years. Most tech employers— at least the smart ones— know the average bounce rate in the industry is high. Older employees tend to value stability, for various reasons. So I don’t buy your argument.
If there’s a reluctance to hire older devs, I suspect it’s because they have higher salaries and maybe because they are (inaccurately) perceived as being unlikely to know or want to learn new tech.