And career longevity. A 40 year old developer is "old". At 50 you're ancient.
A 40 year old doctor is insanely young. A doctor in his late 60s can easily be in their prime, especially in some practice areas or research. Provided they are okay health-wise, even an 80 year old doctor can still be working, especially if they have a strong team. They'll probably be in a mentorship role or a more laid-back practice, but they'll still be earning a meaningful income and having a very real impact on their patients.
And generally speaking, doctors in the West live longer than the general population, so that longevity is better as well.
So far, that really hasn't been a factor for us. It is worth noting that job security becomes much less important as you build wealth. It's a lot easier to build wealth when you're not racking up debt and being underpaid in your 20's.