"Hamas’s broader plan [was] one that analysts say was intended not just to kill and capture Israelis, but to spark a conflagration that would sweep the region and lead to a wider conflict."
This is just analyst opinions. The New Yorker actually interviewed a Hamas leader and got them on the record. He claimed that Israel left them no choice; non violent protests had failed and asking the UN for help failed, and moderate voices were ignored by Israel, meaning only violence was left.
In a country with one of the highest population per square kilometer, that is under a full embargo, can't govern themselves, can't import concrete, wood and other essential materials, which had a 50% unemployed rate.
Gaza wasn't a paradise sitting on aid money, it wasn't a developing country that needed some help, it was an open air prison.
750M of aid per year just from the UNWRA. Billions more in aid dedicated to specific tasks (like the EU's water pipeline project). And the government that was planning to execute an offensive war couldn't build even one public bomb shelter?
So the only option left was to slaughter unarmed civilians. Eye for an eye leaves the whole world blind. The better option was to hit military targets but who cares I guess, tit for tat is all we get