I'm 42 and still coding. I have a lot of rambly thoughts. . . .
I love programming and don't want to go into management, but it becomes really hard to keep upping your salary after the first 5-8 years or so. (And isn't it silly how many job ads for "senior engineers" ask for 3-5 years of experience?) I could join a FAANG but I don't really want to.
You do keep getting better, even when you keep changing the tech. It feels almost unfair that I started on the web in the early 90s (and was coding long before that) so I got to progress along with today's complexity, starting with early HTML, CGIs, debugging HTTP & SMTP with telnet, supporting IE 5 Javascript & CSS, building websites with Perl & Python run from an in-house app server we built in C, on & on. You can go way down the stack and debug things quickly. You know all the junction points to do a binary search on where a bug is happening. Your intuition is well-honed. You have lots of perspective and good judgment. You get better at seeing the big picture, including crossing from the tech stuff to the business.
Back around 2005 I started doing freelance development ("and consulting"), and that has been a great path for me. I earn more, I work from home, I don't live in the Bay Area, I get more responsibility and respect and variety and control. I've neglected to follow most of the patio11 and tptacek best practices, at least most of the time, but I'm still happy with how I'm doing. I've raised my rates a lot, and should probably raise them again. (At the moment I have four customers who all wish I'd give them 40+ hrs/wk. . . .)
I'd like to experiment with value consulting. I'm much better at estimating than other devs will admit to.
My Plan A has been to start my own dev partnership, although it's been hard to find the right people to get it off the ground. I really like Managing the Professional Service Firm by David Maister, and I think the partner/associates model has great potential for making programming viable as a life-long career.
I haven't tried hiring any people (full time or as contractors), except occasionally designers. Maybe I will soon but then you bill less yourself, you have to sell more, you have to manage them and their work, and of course you have to find people willing to charge less than you. (Tech is obviously supply-constrained right now, so getting good workers at a low cost is the #1 competitive advantage. Like everyone else, I believe I can recognize good developers when I meet them, but I don't really have any great process or insights to make that part of a business plan.)
The longer you do it the more T-shaped you become. Eventually your T has more than one vertical line. :-) But still you kind of have to pick one focus to advertise, if only for credibility reasons. I say my specialties are Rails, relational databases, and devops. But then I also do lots of Python, Angular, and React, and I'm happy doing Java or C, even Android & iOS. Right now I'm almost full-time with C#. :-/
I've enjoyed finding researchy outlets for my spare time. In my case it's temporal databases, but there are so many other cool things happening. I wish I had forty lifetimes to explore them all.
I'm glad I've fended off management so far. I've still had to learn lots about sales, finances, project management, contracts, collaborating, leadership, etc. I already spend plenty of time in Jira, customer meetings, and code reviews.
Probably ageism matters less when you're independent. For one thing there are no 8-hour on-site interviews (even though you cost more!).
Anyway, I'm 42 and coding all day, and I'm very happy. I feel totally lucky to be in this career. I feel tremendous gratitude to our community. HN, Open Source, Linux, bloggers, O'Reilly, Stack Overflow, tech meetups, tech companies, friends & colleagues: all have given me so much.