Evolution is, in my opinion, the most difficult domain in science and many talk about, but very few have real comprehension of it.
Therefore and to avoid the first pitfall most are falling into : Evolution theory is merely a concept, it is not a definite mecanism.
There is not only one mecanism that explain the evolution of a lineage, but there are numerous mecanism.
Bacteria dont evolve like arthropodia who do not evolve like a tree or the mammals.
So, about your hypothesis, at some degree, you are talking about some Lamarckism mecanismus.
Its says that the individuals do things during his lifetime and therefore his lineage evolve to perform the need of the ancestors.
The simple example is the giraff whose neck is becoming longer because it need to attain food on the trees.
This hypothesis has been refuted at the time of Darwin (not for scientific reason...) because the british society found here in the darwinian theory a well accepted explaination for the domination of the rich uppon the poors.
So well, the theory was not wrong and further science advance like the knowledge of the ADN showed that this was a good "theory".
But... like i precised at first, it is much likely a concept and not a mecanism.
So, lamarckian mecanismus could be right without contradicting the darwinian "theory".
And i think you are right, there is probably a mecanismus that implie, not only pain or pleasure as such, but also complaining and contemptment (some emotional feeling), that have an action on the sexual cells.
So yes, this sort of mecanismus do not apply to bacteria.
In this case, we could say that the consciousness and the emotional feeling are accelerating the evolution processes.
https://en.wikipedia.org/wiki/Lamarckism