There are weeds that gradually came to resemble the crop they infested. When they were recognizably different from the crop species, people pulled them up or separated out their seeds – automatically selecting for weeds that loo0ked more and more like the original crop. Some of the traits acquired are those we actually desire in a crop plant, such as larger seeds that don’t drop off spontaneously – and so in some cases, a weed became a new crop.
Rye probably started out a a weed in wheat and barley fields. It was originally a perennial, but that didn’t work very well in cultivated fields, so it evolved into an annual, like wheat and barley. It was hardier than wheat, and tolerated poorer soils, so it eventually became the main crop east of the Rhine and north of Hungary.
Oats has a similar origin: it does best in areas with cool, wet summers, like Scotland.
It seems to me that there may be some social parallels: bandits turning into governments, alchemists into chemists, Galenic doctors into almost-scientific medicine.