In this case Hamas has gotten pretty much exactly what they had hoped for, and that included thousands or hundreds of thousands of Gazans being killed, wounded, and losing their homes.
This is the difficulty with sweeping statements about the causes of war...those causes can be far more complex than simple examinations of human emotions.
In Israel, Hamas has two obvious objectives. First, to destroy the alliance between Israel and the Sunni states, particularly Saudi Arabia, that left out consideration of their long term objective to end Israel as a nation. Second, to inflame the region and unite the Muslim states against Israel to further their LTO.
Iran backed Hamas to accomplish their main objective; to break the alliance between Israel, the Saudis, and the U.S. which in their eyes poses an existential threat to Shia Iran.
In both cases these are cold blooded political objectives, not purely sought out of hatred or anger but equally or more a matter of political ambitions, greed, and pragmatic power considerations.
There is little doubt that Hamas exploited the hatred of their foot soldiers but also little doubt that their attack was motivated by unemotional goals.