Fruits, and by extension peppers, evolved to be eaten. Peppers are the fruit of the pepper plant, and generally speaking, fruits act as an enticement for animals to eat them and thus distribute their seeds.
It's just that hot peppers specifically appear to have evolved a strategy to dissuade mammals from eating them, since the chemical that causes them to be hot primarily affects mammals, but not birds. It's actually not an uncommon strategy, many fruits are distasteful or even poisonous to certain animals, but are perfectly edible to other animals in a way that suggests it is specifically beneficial to be eaten by some but not by others.
Fun fact: some fruit evolved to be eaten by mega fauna, giant animals, that no longer exist because uh we ate them. One of those is Avocado. A pit that is way too big to be eaten by fauna of current day size.
I misread what you said. You did not explicitly mention the ground sloth. I am not sure what corpolites etc. Of other megafauna Exist and do not take the time to find out. https://youtu.be/jpcBgYYFS8o?si=AL3boQGU9iX2FHHI
They also suggest that avocados have not been reliant on megafauja.