Putting that aside, no one, not Hamas, not the Israeli public, not Netanyahu, and certainly not the IDF, not any neighboring countries, not the wider world believed the war would drag on this long. Everyone thought it would be over fairly soon. Hamas probably didn't think there would be a war because israel itself was on the brink of a civil war, the Israeli public with their strong belief in their military might thought the war would be over before the new year and the IDF and politicians (BN included) likely had a similar belief, that A) Hamas didn't have an apatite for a long war, and B) the IDF would be able to quickly return the hostages. Everyone else also believed in the might of a stronger more organized force against a much weaker force that supposedly also had to care for their own people.
Instead Hamas showed they had no concern for their own people, and they had significantly deeper fortifications than the israeli security establishment knew about. So here we are almost two years later, and no end in sight.