The reasons age discrimination happen are fairly complex (and I'm not ready to write all the ones I understand out), but to your point about the best in the field being part of the older generation, it is my anecdotal experience that top performers don't seem to have problems with employment as long as they can work (generally). My own mother was exceptional in her field, thought not so much as to be written about, and continued to get job offers out of the blue years after illness had robbed her of the ability to work or even speak, purely off reputation. Her friends and colleagues that I've spoken to have had similar experiences as they've retired having lead similarly successful careers.
Of course, by definition, most people aren't exceptional or even in the top 10% and our society unfairly (and unwisely) punishes them for getting older.