I know nothing about biology, medicine or evolution, but I don't think that's how it works. Lots of people inherit and pass on all kinds of bad genes that do terrible things to them, even kill them. And for such people, switching them off would be better pretty much irrespective of any side effects. (to the degree there even are any side effects at all)
It’s one thing for a “bad” gene to stick around for a few generations or even spread through a species. It’s wildly different for a “bad” gene to be shared by species who’s common ancestor was 60+ million years ago. On that timescale anything conserved is doing something useful.
Useful, yes, but for whom? Not necessarily the individual. The ultimate goal of the genes is to propagate themselves, possibly in another body.
In the contemporary research of aging, the hypothesis that "aging is actually at least partly a programmed process and some genes useful in youth may turn against us later" is taken seriously. There seems to be an intriguing negative correlation between age of sexual maturity and lifespan in mammalian species.
> some genes useful in youth may turn against us later
That’s very much still useful for the individual, from an evolutionary standpoint. Of course finding out what something does isn’t the same as finding it needed for you. People get vasectomies which are hardly something evolution is going to do.
The extreme prevalence of testicular and breast cancer are likely the kind of trade offs that modern individuals don’t want, but they are a likely a consequence of some useful feature for our ancestors evolutionary environment.