"Uncle" Bob Martin once gave a talk where he asked for a show of hands of "How many of you have been programming for 5 years? 10 years? 15? 20?". The results in his audience roughly correlated to his thesis, that the number of programmers has roughly doubled every 5 years since programming was a thing.
Are there fewer older programmers at a given company because of ageism? I'm sure that's part of it. But don't forget that there are far, far fewer programmers with 20 years of experience than with 5 years of experience.
Programming is actually a very permissive industry. There are corporate environments in which you can be barely competent and still keep your job - if not gain promotions.
That's the key to getting a job with 20 years of experience. You need to be able to convince the hiring manager that you're worth the extra money in that job. (And then the hiring manager needs people above him that will let him spend the extra money.)
The only candidates I see regularly wearing suits to interview are executives and college junior/seniors. I'm hiring you to code, not model. I couldn't care less what you're wearing as long as it's clean and reasonably respectable.