Sorry to hear that. It's indeed an unfair situation and nothing is wrong with you, it's the industry that has a problem.
Have you considered building your own company? That's quite a change of skills, but that's what I've seen most "older" developers do.