I started my programming career in 1981 and retired in 2021. But you probably don't know many retired programmers (other than those who retired early due to IPO or Google-type money).
In 1981 there were radically fewer programmers because opportunities were far scarcer. Mainframe-type programming (terminal-server) was most of the job market, with microcomputers or other systems still very early in their histories. Whole countries had no computers or programmers; many small to medium companies, even in the U.S., had yet to buy any. Today there are myriads of different requirements that need programmers; web, mobile, embedded, A.I., etc. Most programming markets started to expand in the mid-90s and exploded in the 00s.
Finding someone who started when I did and remained a programmer throughout is rare and will likely continue until 10-15 years from now. Often programmers, over an extended timeframe, will leave the industry because of burnout or obsolescence or move into management, so staying relevant over four decades and avoiding these things will reduce the pool of those who will retire as working programmers.
I was always writing code no matter my title, including President (two small 5-13 person companies I started in the 80s and ran for nine years), architect, team lead, etc. I checked in code two hours before the end of my last official day of work. I remained relevant and could have continued in my previous job until I dropped dead. My teams always got more projects done with fewer people in less time and dependable quality, despite the challenges of working in a giant company's high-profile, high-stress, and constant change atmosphere.
I probably would have burned out if I had continued for much longer. After forty years, I have accomplished many things and dealt with many, often ridiculous, challenges, but it was nothing new. Doing things that people think are likely impossible does get old; the work was so hard in this last job and was incredibly frustrating at times, with nowhere to hide. However, when the CEO of a company that is so big knows what you are doing, and every exec wants to "contribute" to your project (daily!) and take credit, it starts to get less appealing.
Writing code was always the easiest part of the job; dealing with organizational politics, arbitrary deadlines, constant changes, waffling decision-makers, and a never-ending list of process changes was hard. Despite being the leader of this team, I still wrote as much or sometimes more than other team members and often picked the more complex but less interesting bits; but I also went to all the meetings and did other lead things, so, in this case, I did work too many hours. While it's hard to do both, I always felt I needed to be fully involved in the code as it made things easier to understand and kept my team from too many meetings (I constantly updated them in real-time via Slack if anything important was discussed) meant they were more productive.
Still, at some point, you have to admit it's not fun anymore and move on. However, I do miss some of the work, the camaraderie, eating lunch together, and seeing a project start from nothing and eventually wind up in the hands of customers (for this company, I did mobile and in support of our real-world business, typically 100,000 people a day using what we did).
If I had to go back to a real job, I'd work on a product team, as I was always heavily involved after they made all the decisions trying to make sense of them, and in the past made lots of product-type decisions myself. I would have a massive advantage as I know how to build things and can immediately relate the difficulties or issues in product directions. That might be fun to keep people from making dumb decisions that hinder eventual development! But I have no interest in ever writing code for people again.
When I announced I would retire in early 2021, no one knew what to say since none of them had ever seen a programmer retire at the end of a long career. I also think that since we were all working remotely, it was an awkward scenario anyway.
I still talk with some of my former teammates daily; I don't want to know any secrets, but I still enjoy hearing stories about who got promoted, who is leaving, and how things are going. That's about as close to working as I need!