There is no fitness advantage to being resistant to UV rays. natural selection isn't about you living a long and happy life. It's about you living long enough to breed and rear offspring and whatever happens afterwards doesn't really matter, as it's not selected for. Humans are fertile in 15 years. You can get skin cancer and still make successful progeny.