The reason plants produce these compounds in the first place is to defend themselves against pests and diseases; the more pressure from pathogens, the more polyphenols a plant will produce. These compounds, then, are the products of natural selection and, more specifically, the coevolutionary relationship between plants and the species that prey on them.