The same kind of phenomenon is seen in college graduates who love longer than non-graduates. There is no reason to think that attaining a college degree somehow cures what ails you. Rather, those who are not in tip top health don't have the capacity to make it all the way to graduation.
It is even likely why we see those with more money living longer. While it is often thought they live longer because they are more able to care for themselves, at the same time if you are not in perfect health it is much harder to make money. The same capacity determines qualities like what kind of job you can focus your attention on, and even something as simple as a few extra unpaid sick days each year can greatly reduce your net wealth potential over time.