Just because something provides the conditions necessary for life doesn't mean that all aspects of it are healthy. The world isn't so black and white, but instead, it is full of nuance and shades of grey. In this case: Sure, we'd die without the sun but it doesn't mean that we need a lot of it shining directly on our skin.
Salt is similar: Sure, you need some to live. That doesn't mean that drinking salt water is healthy nor is licking a salt block regularly.