For your friends in derm, I would ask them how hard they had to work to earn their careers. Dermatology is consistently one of the few hardest subspecialties within medicine to get into. You may be able to work 4 days/week later on in your career, but you'll be working non-stop through medical school pumping out research papers and studying for top board scores just to get in to derm. These days, a huge percentage of medical students end up taking an extra year just to get more research out before applying to derm.
Even MD's still have to deal with some annoying hierarchy or another, unless they own their own practice.
Startups, and especially big tech, are relatively easy. More money etc., but no imminent risk of say death or infection.
You can join open source. For example, at dlang.org we don't care how old you are, and we won't pull crappy code.
It is, after all, open source and we make it all available for free.
However, having great contributions to D have landed several contributors very nice jobs. The sponsors of the annual D conference, past and present, did so to look for crackerjack D programmers. I expect it's the same for other open source conferences.
My friends who are now doctors make much more money that I do, they are more respected, they don't have to deal with some annoying hierarchy, and their job is meaningful. As for working hours, it really depends on the speciality, and the hours they chose to work. I know some dermatologists who work 4 days a week for instance.
In the end, I don't regret that I chose a different path as I loved maths and programming and I did some interesting things as well. But nowadays I feel just like a worthless pawn, developing crappy programs, who is starting to suffer from age discrimination...