You guys are taking too much trouble to come up with convoluted 'explanations'. Accepting consciousness as a fundamental attribute of living things is the simplest explanation.
No it isn't unless you can provide evidence that simple organisms or animals with lower neurophysiology have consciousness. And if you do we are simply back into the whole definitional debate.
So to explain these phenomena in terms of consciousness requires either definitional contortion or accepting something for which there is no evidence.
Much simpler to explain this in simple evolutionary terms, of this nature. Species x, edible matter y that is harmful/fatal (or beneficial). Some individuals of that species find that foodstuff distasteful (bitter, unpleasant etc) due to physiological variability. Those members of the species avoid edible substance y and therefore are less likely to be harmed/die. Hence more likely to survive and breed. Confers evolutionary advantage and over time the population becomes increasingly dominated by individuals whose physiology means they avoid that harmful substance.
The argument works with beneficial substances. Also works with more complex behaviours, provided they can be passed on to subsequent generations through genetic/epigenetic traits, or via learned behaviour. And, of course, learned behaviour in many species is also an important evolutionary trait.