If you eat things and spit or defecate out the seeds then assuming a roughly endemic plant and suitable conditions you are going to get more plants of that type coming up where you were. Given hunter-gatherer societies often featured seasonal nomadism, and would thus have experienced plant growth in their seasonal environments through time-lapse staccato, it wouldn't have taken an abnormal intelligence to realise agriculture. It's probably far more ancient than we will ever know.