I find it more useful to think of Hamas as an inevitability when your lock people up in what is basically a radicalization farm without any hope of a better future.
I know Hamas existed long before oct 7th but who knows what might have happened if Israël had accommodated for a Palestinian state after the second intifada, based on the borders of 1948. Like yeah sure the Palestinians might have hoped for more but I think most of them are so tired of the constant humiliation and violence that I think they would have gladly accepted such an arrangement, thereby undermining Hamas' reason to exist.
The fact that Israël has failed to even attempt to come to a reasonable arrangement with the Palestinians in the years after the second intifada is why I blame Israel more than the Palestinians for the current crisis, even though Hamas started the violence. It's all they know. I don't know what my breaking point would be in an environment like that