How do you respond proportionately to somebody who's willing to die to attack you? You can't, and that's Israel's dilemma. That's also why their enemies have chosen this tactic: it's almost impossible to defend against.
A person who's already decided to die attacking you will attack from a school or a hospital or a mosque. They don't care. Attacking from a place you might be reticent to counterattack might give them a few more minutes to inflict whatever damage they can while you hesitate.
The only thing Israel can accomplish with counter attacks is to diminish the enemies capacities before they build up enough strength to inflict more damage.
It's a catch-22 though. The collateral damage from their counter attacks creates more fanatics who are willing to attack them, so each counterattack may end the current round of attacks from that area, but it lays the groundwork for the next round. It is literally a vicious cycle.
So, how do you break the cycle?
It's brutally painful, but one tactic might be to adapt a policy of no reprisals. If Hamas or Hezbollah launch missiles or mortars into Israel, simply don't respond with violence of any kind.
If counterattacks had any hope of ending the violence, then I would never suggest such an outrageous course of action, but since counterattacks don't end the violence, one has to look at the total body count here, not just which side has the most casualties and a policy of no counterattacks dramatically reduces the total amount of suffering in the region.
Nonviolence may be the only hope for dealing with an enemy that's willing to blow themselves up to attack you or launch missiles from a school playground. An enemy who's already decided to die attacking you isn't going to stop for fear of counterattacks. They don't care what you might do to their countrymen either. All they care about is inflicting as much damage as they can before they die.
It may be inappropriate to refer to the teachings of Jesus in this context, but there's a real genius behind his lessons to give your coat to the man who stole your cloak or turning the other cheek.
Israel can break the cycle of violence if they respond, not with guns but with love. If they worked to build up these areas and improve the lives of the people who lived there, despite the attacks, then their enemies would soon learn that life is a lot better with Israel than with the people who are encouraging them to attack Israel and the violence would end.