Most animals do have at least a basic understanding of right and wrong because this is an evolutionary advantage. Altruism often results in something positive in return, and bad actions usually result in negativity. If a dog doesn’t kill other dogs, they’re less likely to be killed by other dogs.
Regardless, animals aren’t morally valuable because of their ability to understand morality, they’re valuable because of their sentience (ability to experience pain and pleasure). Some humans, like babies, sometimes cannot discern right from wrong, but they still have a right to life because they’re sentient.