Like all studies into Vitamin D supplementation that aren’t randomized controlled trials, it’s very hard to tell apart cause and effect. Vitamin D naturally occurs when people go outside and get exposed to the sun, and going outside is correlated with all sorts of healthy traits. Also, publicity of the association of vitamin D with good health has led people who care about their health or who have access to good medi…
When evolution molds a genepool it does so with inbuilt assumptions, one the assumptions is exposure to some level of sunlight. Deviating from these assumptions would result in undefined behavior (in the CS sense) for individuals. If an individual cannot or will not expose themselves to sunlight, taking D3 is probably the best option they have.
A common hypothesis was that vitamin D status was a proxy for sun exposure and not a complete explanation for those health problems.