You do not have to become an "X who programs" when you hit 40. I've worked with plenty of talented developers over 40, all whom see themselves as developers, not as "VPs who happen to develop".
I think you're getting confused by the other phenomenon involving roles, which is that once you accept the management track, you start losing dev mojo; cf. the CTO who loses their commit bit.
I should have mentioned that there is an alternative to "X Who Programs," which is an elevated title at a known company, e.g. Distinguished or Principal Engineer at Google or Amazon. People know that Google Fellows are rare and that it's hard to get there. There the X is "really good engineer". It's harder to get that, for most people, than to get another X.
Software as practiced today, as the province of firms who do nothing but software engineering rather than a back-office function of giant enterprises, is only ~25 years old. The software industry of the 1980s was led by companies whose flagship products wouldn't attract much attention as open source today.
It's not surprising that there aren't that many "distinguished engineers". If you'd entered the modern field at its inception at the start of your career, you're only in your early 40s now. As an employer of several people in their early 40s: they're not particularly distinctive looking. Maybe you know more than you think you do. Anyhow, look at the demographics and wait a bit.
I think you're getting confused by the other phenomenon involving roles, which is that once you accept the management track, you start losing dev mojo; cf. the CTO who loses their commit bit.