But it's a reality in tech that if you're 45 years of age and still writing C code or Cobol code and making $150,000.
It is basic business, if you know C (or pick your language) and are just a programmer and well "experienced" making 150K, a company looks at your as an expensive asset. You may think you have 20 years of experience and add value, but chances are you really have 5 years of experience 4 times over. The company will just replace you with a 5 year experienced programmer or new-grad and pay them half your salary.
You need to be more than just a good programmer these days to stay in the top-earning spots. You need to constantly evolve and gain experience and never rest on your laurels. It isn't an age thing, it's a laziness/comfort thing. It's becoming more of a youth-entitlement thing, but in the end the result is the same. You stop moving forward in your contributions and expect to have your salary keep moving forward. Companies know this and weed these people out.