My wife and I were discussing this last night and she pointed out that Hamas is essentially fighting by medieval warfare rules (ie, essentially none) and Israel is kinda sorta trying to follow modern laws of war.
If Hamas did something like this in, say, Roman times, the Romans would just show up, kill every last living thing, and then salt the earth, and that would be the end of it. And then nobody would even consider pulling a Hamas again for centuries.
But since you can't act that way now, Hamas is essentially impossible to defeat. Unless you're willing to throw out modern morality and just kill everyone.
Israel is in a no-win situation here, basically.
-W
Hamas is practicing Lawfare - using the rule of law (such as it exists in terms of war, international relations, etc.) against their opponent. Hamas can setup a rocket launcher in the playground of a school and if Israel attacks it, they get to claim Israel just blew up a school. If there was no law of armed conflict then Israel wouldn't feel constrained to try and avoid civilian casualties. Hamas also wouldn't have any reason to use human shields. However, the logical conclusion of that would be complete genocide/extermination ala the Romans, the Mongols, or any other group in history facing an enemy they couldn't subdue, etc.
It's the same problem every democratic country has faced in warfare over the last several decades. Russia has no need to restrict their attacks in Ukraine to military targets - they deliberately target civilians all the time. Same with Syria or any other autocratic country. But they're all quick to point out the splinter in their opponents eye when civilians are accidentally killed, while ignoring the log in their own eye.
War is the suspension of our laws against killing, directed at some "other" group. It will never be a moral activity, but people who lived through the horrors have tried to put it in a box.
Various attempts have been made to keep war within the boundaries of military forces, to restrict attacks on civilians, to restrict certain types of weapons such as chemicals or nukes, and to prohibit things like torture and ethnic cleansing. Arguably these attempts have failed and there has never been a fully "lawful" war, but on the flipside we aren't (yet) living in a world where the Israelis are dropping Sarin gas on Gaza and exterminating millions, the Serbians were running concentration camps, or the Russians are using tactical nukes to exterminate the Ukrainians. That world would certainly come if we gave up the political pressure to put boundaries on warfare.
The issue is some organizations are immune to such pressure, and have nothing to lose in terms of their international standing. Hamas, Syria, the Taliban, Boko Haram, and Al Quada/ISIS can apply "might makes right" ideologies to limit the outrage of their own populations, while attempting to obtain asymmetric advantages wherever they can. Currently, most "laws of war" violations are committed by non-state actors and religious radicals, but it is fair to ask why totalitarian countries like Russia or China would be constrained. They can control everything their people can or can't see, and so they won't face protests in the streets if they commit genocide (or in the case of China, IS committing genocide).
So far, what's working to keep Russia from using nukes or chemical weapons in Ukraine is diplomatic and economic pressure, plus the threat of NATO going on a war footing and probably outrunning Russian military production and demographics. I think it's fair to say Russia is being punished beyond their worst expectations by a united front of many more countries than initially expected. They didn't foresee the unity and expansion of NATO, or the willingness of Europeans to suffer for the sake of getting off Russian natural gas. Russian allies in Belarus, Hungary, and Moldova have been sidelined after watching the shift in public opinion.
China meanwhile, would face a Western boycott, asset seizures, and a Western military buildup if they start bombing civilians in Taiwan or ethnically cleansing the Philippines. That might not be enough, because foreign influence only goes so far. China lacks the vulnerabilities of Russia and knows the US is utterly dependent upon them to finance our budget deficits and keep our goods inflation low.
The past couple of years have seen Western countries realize their incentives for rules-bound warfare are weaker than initially expected, and dictatorships like Russia can potentially ignore such structures. Yet, Western moral outrage at Russian aggression has united the squabbling Europeans and created a bipartisan majority in the U.S, while on the flip-side, moral uncertainty is hurting the morale of Russian soldiers, led to draft dodging, and probably harmed the unity of the Russian people (also see the rise of Russian partisan units attacking Russian villages). Being the "good guys" has strategic value because it can lead to national and international unity in and among free societies.
The West, and Israel, might be unwise to trade this massive advantage for some sort of short-sighted tactical parity with terrorists and dictators. To the extent the U.S. ignored its own rules in "the war on terror", with torture sites, detention without trial, strikes and recriminations on civilians, etc. it lost internal support and eventually lost "the war on terror".