So in a way plants do think, correct? or what makes them self preserve and thus generate food?
No evolution does not happen that way. The development of a fruit for example starts as a totally random event, no doubt just a few cells attached to the seed. If that improves the chance of that seed being eaten by a bird or animal and subsequently excreted to grow into a new plant complete with the mutated gene for fleshy seeds, then that gene will do better in the gene pool than those that produce seeds with no flesh.
Over generations multiple mutations accumulate to produce the kinds of fruit we see today. We often speak about elements in the natural world being "designed" for this or that but it is only a shorthand way of speaking. The "watchmaker" is blind. Nothing plans to evolve anything; changes happen by chance, those that are beneficial are selected by natural selection which is not random.
Its helpful to see it from the perspective of the gene as Dawkins proposed in "The Selfish Gene". Bodies of animals, humans, vegetables, trees, apostates are gene reproducing machines. Those genes which cause the body or phenotype to do better at reproducing get copied more often than genes that don't.