I was watching a PBS special on how plants, through their roots, compete with other species and sometimes support their own relatives. The narrator and some of the scientists hinted at plant cognition and asked the viewer how plants think. Observing analogous dynamics in software, it’s clear that there is no brain or thinking required.
These types of behaviors can have local (cellular) controls and do not require central planning. Coordination emerges from the cells’ common responses. All plant roots produce chemicals and these chemicals can promote or inhibit growth, trigger other chemicals, etc.
This leads me to point out another widespread misunderstanding of human behavior. A lot of what we do is conditioned or innate, and does not use the brain. Our bodies have nervous tissue throughout, and muscle stimulation originates all over the nervous system. The brain gets too much credit for the complex system of cells that in many cases are doing their own thinking in their own simplistic way.