Immune system genes respond to pathogens, which change rapidly, so the genes also change rapidly. If the pathogen is no longer there, then you don't need the immune system gene in the host.

With the development of a sexual color scheme, you don't need the pheromone sensitivity to sense whether a female monkey is ready to mate. It's advantageous to use visual cues rather than pheromones, because they can be seen from a distance.