Thats what really worries me, sure I like coding and learning now but what happens to me in my late 40's and 50's when I have to care for my parents and kids at the same time while tying to not become a IT dinosaur.
I think at all ages you have to leverage what you have. When you're young, you have a lot of energy, so you learn a lot and work a lot.
When you're older, hopefully you have a lot of money and a lot of experience, so you can (i) use the money to retire or pick what to work on, or bootstrap your own startup (ii) use the experience to become an Engineering Manager, Technical Product Manager, etc. That's _if_ you don't feel safe as an individual contributor, which is imo reasonable in areas where seniority has a short half-life (eg. front-end / web tech seems to be like this).