Unfortunately that’s what happens when you hide behind civilians. Hamas could easily end all this, Israel has offered peace treaties multiple times. The issue is that Hamas is literally an islamic terrorist group that doesn’t care about their people, only the destruction of Israel.
Sorry but that analogy doesn’t fit the situation. It’s more like if someone took your family hostage, and as you shoot at the kidnapper they threw their own family in front of them to take the bullet instead. Two stupid choices that they made themselves and could’ve easily avoided.