Most people within Hamas didn't know. Hamas won't inform anyone as it is playing catalyst role. Others can't play that role. For example, Hezbollah launching such a large scale attack would be a political suicide for them when it comes to internal Lebanese affairs. Hamas on other hand governs Gaza, and made veiled warnings about the operation, if it the siege on Gaza continued. And people of Gaza were demanding something be done about the economic situation.
Still, they rely heavily on each other. Syria and Iraq aren't replacements for for Hezbollah and Hamas. Hezbollah and Hamas have similar upbringing. Both grew out of Israeli occupation. Both have similar form of government. Both exist as populist Islamic resistance movements. If one goes down, it is bad for the other, in the long term. Hamas also provides inroads for Hezbollah into Arab society and media. And opens relationships for it.
Hezbollah cannot rely on Syria for its future. Hezbollah had to intervene in Syria as it was considered a existential threat to Hezbollah and Lebanon. But they do not love the government there. There is bad blood between them and Syria in the past when Syria used to intervene in Lebanese affairs. And Iraqis don't seem all that effective nor organized. Factions there appear more business/lifestyle oriented. Ultimately, it is important to Hezbollah that Gaza and Hamas survive. That does not mean they will take a path to attempt intervening with a war. But it means if one or the other is lost, it's going to have direct consequences on the other, in the future term.