Unless you are deficient it's not the vitamin D. It's a whole host of other processes that benefit your body from sun exposure and the activities that go along with it. The Vitamin D is just a marker that we can detect that can also be related to that same exposure. So there's a huge number of things for which people with high levels of Vitamin D do not suffer but supplementing has no effect because the vitamin D is only correlated not causative.
But wouldn’t this imply that optimizing the tanning bed properties for vitamin D production is worse than looking for as-close-to-sun-like sources of light?