Here's a massive meta-analysis of tens of thousands of participants finding a reduction in mortality associated with vitamin D supplementation:
https://www.cochranelibrary.com/cdsr/doi/10.1002/14651858.CD...
Vitamin D + calcium supplementation for bone health in middle-aged or older people:
https://link.springer.com/article/10.1007/s00198-015-3386-5
But you're right that some of the benefit of "vitamin D" will be associated with going outside. I outlined several reasons in my article: the outdoors has brighter lights, lower carbon dioxide, etc., which are good for our health.