It seems this fixation on the shiny "interesting" jobs is another problem. I'm not getting any younger and I don't doubt there is some ageism in the industry but if we're biasing the search to only include FAANG and a handful of other darlin companies then that's not really a fair analysis of the situation.
Anecdotal but I've seen >40 year old engineers thriving at non tech-hub software companies. There's plenty of interesting B2B companies that lurk in the suburbs or tier-2 or tier-3 cities.