Hamas offered the hostages to end the war within the first week or so, Israel refused, as they did many times later. They also got many warnings about the attack, even from Hamas. It was always about the destruction of Gaza, the situation is manufactured.
And then Israel has done everything it could to kill the hostages. Perhaps because it's afraid the stories might get out, of how Hamas treated them. I wonder why it might be afraid of that.