Yup, indeed. Of course, they may not understand politics, or share markets or stuff like that, but that doesn't mean dogs (and cats) are completely without intelligence and only acting on instincts. Of course, it's not always a good thing, like I used to take care of a cat who figured out how she could open the fridge in order to steal the food inside, but the point is, if she wasn't smart, she would never have found out how that works.My current cat showed a form of compassion to me when a kind of illness struck me, and she's been of great support to me until I felt better. (I still need to undergo surgery for that, but still).
And dogs saving lives like in the meme above and in the story of my cousin, proves that the dogs rightfully recognized the mortal danger, and chose to act. Yes, cats and dogs, and more members of the animal kingdom, are very very intelligent creatures. More intelligent than we human give them credit for.