That's called collective punishment, and is a war crime.
They're not really neighbors. Gaza is more like a prison controlled by Israel. Israel has controlled Gaza's electricity, food, water, and the movement of its citizens for many years. I believe even before this attack, Israel only allowed Gaza 4 hours of electricity per day.
Also, in 2019, the PM of Israel reportedly laid out a strategy to "bolster" Hamas and provide them funding to oppose the Palestinian Authority. Hamas, in its current form, would not have been possible without Israel creating the perfect conditions for terrorist organizations to thrive. Israel keeps the conditions so bad, the average age in Gaza is 18. So, half of those Palestinian death toll numbers we are seeing are likely children.