Hamas and other terrorist organizations like Hezbollah have worldwide reach, and through contacts in Lebanon they are in talks to receive more weapons and training from Western enemies like
North Korea (on a sidenote that's probably where the Hamas tunneling strategy come from; North Koreans have the largest commando force in the world and have tunneled through the DMZ if I recall correctly).
Hamas uses Gaza as a tar pit that will slowly drown Israel because Israeli military actions is basically like shooting at sand. Every civilian that is displaced is just more fuel for the Hamas war machine, and is another minor victory for their benefactors like North Korea (because Western reputation, money, and war support becomes weaker).
In my opinion even if Israel went full-Nazi and wiped out Gaza they will only breed more extremists much like ISIS in Iraq, or what happened with USSR/USA in Afghanistan. Israel has started an avalanche and realistically I don't see the vicious cycle ending.