I don't think this is an accurate description. It wasn't "an act of terrorism". It was an invasion and jointly, a rocket attack, by a neighboring semi-state with a military, that has stated it will invade over and over again. And of course, the capture of 250 hostages.
This isn't a kind of one-off terror attack that was met with revenge for the sake of it. For the months after the initial invasion, Hamas fired thousands of rockets at Israel, essentially shutting down the country for a few weeks, until they were forced to stop. Hamas militants were literally running around inside of Israel for two days.
No nation on Earth could afford to effectively cease functioning as rockets rained down on it, and as other parties like Hezbollah were threatening to widen the conflict to a far more serious attack as well.
> If the Palestinians stop defending themselves with terrorism would Israel play nice?
I can't answer that, but it's worth noting that during the 1990s there was a sizeable Israeli left that was pushing for peace, there were talks, there were accords that gave the Palestinians self-governance in the West Bank, etc. This was met with terrorism, with the express purpose of stopping the peace process.
It's also worth noting that Israel completely left Gaza in 2005, removing all its settlements there and the soldiers there. Gaza then elected Hamas, which immediately started shooting rockets at Israel.
So while I highly dislike Israel's right-wing government and extremism, and highly dislike the settlements, I don't think it's accurate to say that the terrorism is helping protect against anything. It comes from a worldview in which Israel will eventually be completely destroyed and the Palestinian will take over all the land.