You're right that it is possible that Hamas didn't intend for the scale of civilian casualties that were seen on Oct. 7th, but even if that's true then they are still responsible for not keeping their people from commiting said spontaneous violence. As the leaders of a militant faction, like a regular military they are responsible for training their soldiers (or equivalent) and keeping them in line during operations.
I'm actually more on the Frantz fannon school of thought about the necessity of violence against oppressors to overthrow colonial regimes, so I'm more amenable to hamas' plight than most I think, but Oct. 7th is still pretty indefensible.
Having said all that, to make clear, I'm not defending Israel or their retributive genocide. Fuck them. But I don't think we should go easy on Hamas' war crimes either, so I don't think the ICC is really 'both-sides'-ing in this case.
I'm no expert on international law, but from what I've seen for more isolated incidents generally it's those who commit the crime that would be held responsible. The scale and consistency of civilian death pretty much rule that out though, which leaves either intentional orders to kill civilians (more on this later), or institutional failures to properly reign in soldiers and train them to not kill civilians. either way, that puts the onus higher up the chain of command.
If we assume that civilian death wasn't intended by top brass, there is still a huge fuckup somewhere in the mix if somewhere near half of all those killed were non-targets of the operation. Again, with the scale of this massacre, I can't imagine it not being a categorical failure of command all the way up in allowing this to happen.
If we assume it was intentional, well then Hamas ordered the killing of hundreds of civilians. that's pretty cut and dry not cool in the ICC's books.
The real problem I think is one of perspective. I believe that from the perspective of Hamas, any and all Israelis are themselves combatants, as settler colonialists continuing the project of eradicating the land of Palestine. There is truth to this, but then from that perspective there are no civilians in Israel. Once you come to this conclusion, there isn't a lot that can't be justified.
From that perspective, the difference between killing Israeli soldiers and destroying military targets vs killing Israeli citizens and burning down whole city blocks isn't as significant as the ICC or (I assume) you or I deem it to be. It's more like targeting barracks than harming non-combatants; something like "Sure, maybe they aren't armed and attacking right now, but they are still the enemy and pose a threat. They chose to be part of this conflict by settling here".
Like I mentioned, there is some truth to this logic. Israeli settlers, especially near Gaza and in the west bank, are complicit in the acts of their government and are continuing the colonial project. Does this justify their indiscriminate murder? I don't believe it does.
So, in summary, I believe the massacres were planned, or at least allowed by hamas' strategy. Even if it wasn't intentional, that it was allowed to happen still incriminates most of not all of the decision-making and on-the-ground commanding portions of the organization. But that's just my 2 cents.
Edit: spelling