To your point, a confounding variable could be that diseased people go outside less (and therefore have less vitamin D)
In slovenia, most of the deaths are in old-age/nursing homes, where most of the patients have severe health issues and a lot of them are bed-bound. Yes, they have lower vitamin D, but also many other health problem, so looking at a single variable (vitamin D) proves corellation but can't prove any causation without interfering (eg. giving half of them vitamin D supplements, to compare to the other half).