A bit like how capsaicin was evolved to prevent things being eaten by mammals, but... Well.. humans came along and developed a taste for it.
"Evolution! Can you give me capsaicin, to deter mammals? I want birds to spread my seeds!"
https://youtu.be/1fW2uTRdUJU