It is difficult to comment on your experiences, but I too am very near retirement as well. My recent job as a contractor has been a challenge, because the manager is not a technical engineer, in fact not an engineer at all. The methodologies used by said manager is to always try and take shortcuts, although my niche job as a harness design engineer keeps my focus rather narrow, I have to deal with decisions made by said manager. Since this is space flight, I stick to my requirements and always refuse to take shortcuts, some of the decisions that I have no control over still affect my area, and I have to live with them.
With that said, it is very difficult, at times, to hold it together and go forward and deal with the problems that arise from bad decisions.
Bottom line, I feel your pain brother/sister, and it is a deepening travesty that this is happening to older folks who have so many years of experience and still much to offer. I don't feel like I know everything, but what I know, I know well. For real leaders where I work, I am recognized as being knowledgeable and given due respect, but for many younger folks, I am seen as an old man only, without much value. I see articles and social media memes all the time about how the 'baby boomer generation' is the root of all of the younger generations problems. This is a short-sided view, IMHO, and, if it continues, will create an even larger rift between the older folks and the younger ones.
I don't have any answers for you or all the social and workplace problems, but the one thing that I still believe is that, despite the occasional person that is obtusely opposed to thinking logically, there are some who will see the need to learn from our older generation. Please do not put us on top of a pedestal, because after all, we are still only human, with all of the earmarks of human flaws, but, when it comes to our knowledge, which IMHO, is achieved through the years, give that the respect that it deserves, no more/no less.
Just my 2 cents...