If I can offer another angle: I'm not a full-time programmer and never was, but I code in a number of languages to support my real day-job (finance). I'm getting close to 50 and I feel the value of my coding skills only increases year after year. Why? Because if you combine solid programming with deep subject domain experience, you offer something that is quite rare. I've always thought of my coding skills as an insurance policy should my day job implode. The premium is quite steep though - I spend a lot of time keeping-up with language developments, new frameworks etc.
Why?
This is actually a really interesting question - especially given the HackerNews readership - so much of today's code production is for vapor ware I.e. Here today, forgotten tomorrow. There is some value in understanding what leads to career longevity in this business.