Regarding your first question, not really. It reacts to stimuli (light, heat, pain, and so forth), but it’s not capable of independent thought beyond that.
As for why it evolved, the going theory is that it’s actually a store for nutrients, but the way a cherubi’s body is structured (which is ideal for hanging from branches but not so ideal from keeping this store away from predators) required it to develop a means of protection. A rudimentary pseudobrain just happens to be a rather effective warning system for a main body. (See also: girafarig.)