It's tragic, but there was and is wide support of October 7 attacks in Gaza, as well there was wide participation of the civilian (non-organization aligned) population in the massacres, including looting, killing, kidnapping and probably rape.
Furthermore, Hamas was elected by the population under popular vote, and it is a palestinian organization entrenched in every facet of civilian organizations and life, and strongly stems from palestinian cultural norms (e.g. islamism, martyrdom, etc)
You cannot completely act as if Hamas is not the defacto government in Gaza, and in any war in history, especially urban warfare in civilian setting with non-uniformed combatants, you cannot truly hurt only the military apparatus without also hurting civilians. This is simply a fact of life.
It is a Western trope going as far back as the Nazis to act as if governments have no representation of their citzenship, especially authocratic ones. Even to this day for example, the German government of 1933-1945 are called 'the nazis' rather than germans, as if they came from outer space, and returned to their planet on 1945, leaving none of their members in the Western/Eastern Germany governments.