Our understanding of animal empathy and alutristic behaviour is an exciting part of science which is starting to show some amazing things.
So far, scientists can not yet show any "human" trait that is not shown in nature. We are exactly the same as our counterparts, and vice versa.
One experiment that sticks in mind is where rats were given the knowledge of how to open traps, then they were placed into a room with an unknown rat in a trap, the rat nearly always released the stranger. Later on the experiment was done with the option of food or releasing a stranger, nearly every time the rats would release the stranger before then going for the food. Animals can empathise and sympathise as humans do....well at least some can, which animals can is the question, and also "why"?
Another was where dolphins were making themselves into a buoy to lift an injured friend to the air, preventing the injured from drowning... unfortunately the injured dolphin did die, but the others were seen to be probing and prodding it until after some time they seemed content that there was no life at which point they allowed the carcass to sink.
I personally do believe the dog understood exactly what it was doing and was doing so for the other animals sake.