>>I would say the majority of 40 year old programmers are just as useless in the other direction.
This has nothing to do with age. In most people's case swim lanes are set early in life. If you weren't good enough at 23, unless some major incident in your life changed you, chances are you will be the same at 40.
This has largely been a problem- most people feel with this popular phenomenon called 'Nerd culture'. Some people have it all figured way early in life, others take long, many never. This fact alone counts for different starting points in life, overall seriousness, and the net time available to make progress. Also if you started out as a Nerd earlier, you are more curious, and more eager to learn, change and adapt to things. Than people who start out later, who just wanted a job to provide for their family, and are in purely for 9 - 5 kind of a job, those people will routinely find themselves stuck in the wrong job- As they have to spend bulk of their time learning things. While they might want to spend that time on recreation.
This whole thing about learning and exploring things just for the heck of it doesn't come naturally to most people.
From my own childhood I remember a bunch of bullies from my lane, routinely taunting and beating up kids. One of them grew up to his mid-20s and woke up to the financial realities of life. He then went to college and did his engineering. But that was 8 years after I had finished my degree, and had a neat 9 - 10 years experience compared to him. I once met him in a bus and he came across as a totally changed person, but he still struggles. Largely because the impulse to do things is different, he just wants a job, and beyond that bulk of his early life throughout childhood, teenage and early adulthood were spent doing unproductive stuff. So there is just no desire or curiosity, or even the mental tools required to sustain a continuous learning life long marathon campaign.