Plant resistance to pests are a constant back and forth game. One generation will mostly get wiped out by some secondary metabolite a plant would produce.
The survivors will breed, eat the now abundant plants, and the population skyrockets until the plant makes some new secondary metabolite.
And on and on we play this game.
Plants are essentially biochemical factories.