As a reminder: Something may be selected for because it provides a benefit, but unless it has a significant cost (in terms of metabolic demands, or preventing the animal from doing something) it’s unlikely to be actively selected against. So “evolving as” is often a somewhat misleading phrase.
(Oversimplifying slightly, but I think the point needed to be made.)