I also wonder how much of the perceived age discrimination is due to expectations of an ever-increasing salary. I remember one older co-worker that interviewed for a job, liked the company, and got an offer that he dismissed as "not much higher than entry level" and even called the offer insulting. My line of reasoning was that if he didn't have relevant domain experience why wouldn't get paid not much more than a new grad? It was still well into the 100-200k range - in the Bay Area but in a cheaper city (San Bruno I think). More than enough to save and live a comfortable life. I wonder how much of the perceived age discrimination is more about being realistic about the fact that years of experience don't automatically translate into higher productivity, paying younger folk commensurate with their contribution - as opposed to other industries where it's entrenched that young people get paid less and older people get paid more.
Not saying age discrimination doesn't exist. I've seen job adverts that explicitly specified an age cap of 40 (despite this being blatantly illegal).
1. https://www.businessinsider.com/silicon-valley-age-programme...
It's worth noting that surveying from Stack Overflow can mean significant selecting bias.