I think that being in the sun is good for you. However, you're making some leaps in your thoughts here.
Looking bronzed is associated with wealth and leisure which is also associated with strength and good health. In the past, a tan was associated with working outside, being a peasant or a "red neck", and thus not associated with good health, at least not in a positive association.
And people stay out of the sun for many reasons besides skin cancer. The sun may feel hot and uncomfortable. Some people can take the heat and others can't. Some people burn quickly and others don't. Some are bothered by glare and others not. When I plan to spend a whole day out in the hot sun, I cover my arms and wear a broad hat. It's more comfortable.
But you may be on to something that you have more raw ingredients in your diet to convert nutrition to Vitamin D. Vitamin D makes you feel good and when something feels good you are drawn to do more of it.
Female, 5'3", 50, Max squat: 202.5lbs. Max deadlift: 225 x 3.