I would doubt the code first. If it is built on layers of indirection that's a sign there's an abstraction that's not being made which could simplify that code. We write code first, and foremost, for other humans to understand. If it's too hard to understand due to all the indirection that's a problem with the way the code is written, not you!
A big difference I find between myself as an engineer now (40s) vs myself in my 20s is that I have the education, experience, and wisdom to appreciate elegance and simplicity. When I was younger I would throw myself at a problem and keep adding code until the program did what I wanted. I could only imagine what people meant by "elegance," and "simplicity." These days I rely more on mathematical reasoning and think about the problem before I start writing code. I feel as though I can finally see that simplicity is not effortless.
Barring very specific health complications, cognitive decline is not a major factor for most people in their 40s.
Most programmers are fooling themselves if they think they can keep the state of more than a handful of variables in their head and detect errors or understand the entire control flow. That's a code smell, a problem, something that should be addressed. After all: if you can't understand the code, and the next person has difficulty as well -- if you need to make a change to it, how do you know that the change you've made is correct? Do you know that this code does what it's supposed to?