Hamas has already agreed to any number of "ceasefires" which included phased release of hostages. If Hamas surrendered and released all the hostages unconditionally, Israel would just find some other way to promote a grouping that was willing to fill the role of "armed enemy," and keep right on doing what they're doing.
Doing the invasion on October 7th was clearly a vicious and catastrophic mistake, because it provided Israel a pretext to get started with all of this latest phase of their plan. But you can't blame Hamas for it any more than you can blame the nightly news anchor for lying on TV. That's the whole reason they have the job in the first place, it is a prerequisite.