Why exactly is this? And why would anyone go into a profession where they will be unable to find work when they are half way through, and at the peak of their powers? In every other intellectual enterprise--doctors and lawyers particularly--they hit their peak earning years just as software developers because (supposedly) unemployable.
This makes little to no sense. It isn't like good older developers become magically incapable of learning new langauges or frameworks. It isn't as if they become less reliable than a 20-something just out of school. It isn't as if they suddenly forget 25 years of history that lets them make more accurate effort estimates than anyone else.
So where does this perception that developers must be young come from, and why does anyone go into a profession that by definition (apparently) is going to require the to change feilds mid-career?