Sample size = 1, I'm closing in on 50 and moved from programming to product management and then project management about 10 years ago. It was a significant compensation hit, and the skill gap took a lot to overcome (I am a much better programmer than project manager), but overall I am happy with the change. I took a look at my trajectory in my 30s and didn't like what I saw:
1. I didn't want to be a JIRA ticket monkey for the rest of my life, and people management seemed way out of reach.
2. The "win the battle, lose the war" pattern of projects started getting demoralizing: You're developer #21190 on the team, make the best technical decisions in your little corner of the product, but after a year it gets canceled or fails because some decision maker way above you on the totem pole blew a deadline/estimate by an order of magnitude. It's tiring to do your best work on projects pre-doomed to fail.
3. Work life balance sucks as a developer. I spent countless nights working through to 2AM to meet my ever-increasing ticket goals.
4. The technology-of-the-month treadmill gets you nowhere. I'm all for learning new things, but the constant emphasis on switching to a new fashionable framework just because it is new and fashionable, and just to put another keyword on your resume, is IMO a waste of learning.
All in all I felt like a well-paid cog under enormous pressure to always be cogging harder.