While this is technically correct on the surface, it doesn't really tell the whole story imo.
Israel is a nuclear power that has the ability (and clearly the willingness) to eradicate Palestinians from its territory. Hamas is a guerilla militant group. Yes they're both evil, but more practically, only one has the ability to end this conflict, and it's Israel.
The way you phrase it poses an impossible dilemma for Palestinian resistance. Non-violent resistance is outlawed and slaughtered (anti-BDS law, massacre of the Great March of Return, assassinations of peace activists, international smear campaigns, etc.). Violent resistance is impossible on equal standards as Israel maintains air superiority over occupied Palestine - separate infrastructure would be bombed. So we have a ghettoized population, under siege, under blockade, under air monitoring. What option is left for them? Hidden military infrastructure, tunnels, arms smuggling - and this all gets immediately condemned.
We try to hold these populations to the standards of international law - but morally, the abstraction starts to break down. It's easy for a country like the U.S. to abide by some of these standards on the surface - we can have exposed military infrastructure, because we have SAM sites, we have intercontinental ballistic missiles, first-class fighter jets, etc. We've heard plenty about the perspectives that purport to justify the Israeli/U.S. offensive, that seem on the surface to make our military efforts legitimate. But (from the media at least) we rarely hear about the narratives in support of the opposing side - 75 years of ethnic cleansing, land theft, crushing military occupation, siege, perfidy, random massacres and apartheid. They have a legitimate cause and grievances. So we have to actually consider what avenues of recourse are even available to them to pursue that cause. Otherwise we're essentially just telling them to "quiet down and die". On the broader scale, it's like saying, it's forbidden to punch while you're lying on the ground, while you tackle somebody and beat them to death.
That being said, of course certain things are both war crimes and not essential to resistance - i.e., killing unarmed civilians - to whatever extent Hamas militants actually did engage in this (we know they killed some, and we know the IDF killed some as well - as well as the 13-20k+ civilians Israel has killed at this point).
And this is not to give credence to Israeli claims of repurposing, either. The standard under international law is to prove that each individual peace of infrastructure is actively being used for military purposes, and that its strategic value outweighs the casualties from shelling it, and Israel has not been meeting that standard overall by any metric.