This is what I was thinking and it's not just a human thing. There are so many videos of various animals befriending each other, when one would kill the other in the wild.
Having basic survival needs met allows the space for compassion and other noble instincts.