Dogs will not take food from someone who refuses to help their owner. This characteristic is relatively rare; it demonstrates that dogs are evaluating humans-- socially, and emotionally-- even when the human has no direct relationship to the dogs. Further, dogs are willing to forego direct self interest for the sake of reinforcing social norms of altruistic, kind behaviour.

This is a key trait of collaborative species, and has been observed in humans and tufted capuchins. Chimpanzees don't seem to prefer helpful individuals unless it confers a direct benefit to them.

It is important to distinguish how this sort of trait evolves-- it does not evolve by group selection, in which cooperative traits benefit a group. Instead, reciprocal altruism is powerfully selected for in natural selection because of the benefits it confers to individuals.