This is only if you let it. The human brain has something called neuroplasticity. If you exercise your brain, regularly and with variety, you can slow/prevent a degradation of neuroplasticity. Some example activities include doing coding in new programming language, learning a new spoken language, doing sudoku and other puzzles, doing painting if you are right brain dominant (or logic puzzles if left brain dominant).
The OP's statement also is one of the key reasons touted for ageism within our industry, and ageism is a major problem. The benefit of vast experience drastically outweighs the minor (or no) degradation in neuroplasticity if they've kept their brain active.
But as I kept learning, I saw that a certain set of people decided that they were just done learning new stuff the second they were done with college, and resisted any change that wasn't taught to them by their professors. This affected young and old people at roughly the same rate (at least from what I observed), but it's more apparent for the older people just because they've been half-assing the learning for longer (and because what they learned in college is probably more out of date).
This is also why I make it a point to attend conferences where I am the "dumbest guy in the room" like ICFP. These things are a bit intimidating (I do not like feeling dumb), but work as exceptional ways of highlighting gaps in my knowledge, and giving me a "path to google later".
To be clear, this isn't about IQ or number-of-wrinkles-in-brain or anything like that. If I were to talk to a carpenter about carpentry or Taco Bell worker about food preparation I would feel stupid since I know basically nothing about either of those subjects.
Just be careful as there’s no such thing as left/right brained people. It’s an old idea.
The positive side is that I'm in the second year and things have improved. I suffer less from stress and many maths are now "restored" in my mind. So it gets better. But the price is high :-)
I guess that by the end of the thesis, which is less about emorizing an dmuch more about understanding, I'll feel much better and self confidence will be boosted...
There's also a use/abuse aspect. My older body creaks not necessarily because it's old, but because I have used (maybe abused - I started Jiu-Jitsu at 40) it physically for 40+ years. I suspect the mind is similar. If it's been abused through stress and/or drugs or let go out of shape by watching TV all day, then yes it's less sharp. But age isn't the driving factor in that case.
I've made it into a mantra to never accept this kind of sentiment (even if it were to be scientifically proven some day). It's dangerous and only serves to undermine motivation. Sure there is an overrepresentation of old people who are tired., but that doesn't mean you have to be.