I´ll use myself as an example.
I started coding professionally at 23 (I´m 43). For years I pushed myself to be the best coder I could. At 35 I got laid-off. After that I just got sucky jobs were I´m treated like they have me there as a favor (and I work with the latest, and I´m, even with the pessimism, a top performer).
A coworker of mine that thought that coding was a losers job, coded for some months and went to work as a B.A and later as a PM, nowadays is an engineering manager which earns way more than me and is treated way way better. His whole programming experience is an 8-month part time stint with Winforms. And sadly he is not the exception...
In most places devs are being had.