Yes. There is certainly an evolutionary advantage in creating an insecticide that also attracts species that helps the plant reproduce or spread.
Tobacco, coffee, cocoa or cannabis for that matter will never have to fear going extinct.
Tobacco, coffee, cocoa or cannabis for that matter will never have to fear going extinct.
It is rather a "side effect" that came about later.