In practical terms you avoid the situation entirely by not operating an open air prison for decades and indiscriminately bombing civilians, thereby breeding terrorists with nothing to loose, and then cutting off the food, water and electricity to civilians as a collective punishment.
You guarantee Israel wouldn’t do this if they had a better option? I think it’s far more likely that the far right in Israel have just been waiting for an excuse to do this.