Sun exposure (and even tanning beds) produces vitamin D, but it also causes other changes in the human body. It appears sun exposure OR tanning bed use (!!!) reduces all cause mortality.
I think there's some confounding factors in 'outdoorsy' people having other healthy lifestyle habits, but it also seems likely that there is some other mechanism, beneficial to human health, triggered by uv exposure.
"Avoidance of sun exposure is a risk factor for all-cause mortality: results from the Melanoma in Southern Sweden cohort" https://pubmed.ncbi.nlm.nih.gov/24697969/
I think there's some confounding factors in 'outdoorsy' people having other healthy lifestyle habits, but it also seems likely that there is some other mechanism, beneficial to human health, triggered by uv exposure.