Hamas breaks way more rules of war than Israel does, this is the punishment for that. It is impossible to "play fair" when the opponent is hiding their active soldiers among civilians, there is a reason that isn't allowed.
This doesnt change the rules for war states agree to. No matter what some group in conflict does. Especially if that group is minority and you are the significantly more powerful.