Term for trait that is advantageous to a population only as long as it is rare
Frequency-dependent selection is the term you are looking for, I believe. Positive frequency-dependent selection encompasses traits that become more advantageous as they become more common. Negative frequency-dependent selection encompasses traits that become more advantageous as they become rarer.