To me, this is what it is. If young Humpbacks are vulnerable for a certain amount of time, being good at protecting them would a good idea. They can't risk losing that skill since every time they fail, a young Humpback dies.
It wouldn't need to involve cognition and logic, it could be evolutionary coincidence: humpback whales with behavior that happens to result in fewer orcas nearby would have more surviving offspring, so this behavior would be selected for.