It's the direct result of the political ambitions of Netanyahu, using Hamas as a wedge for Palestinians to have less power[0][1].

> According to various reports, Netanyahu made a similar point at a Likud faction meeting in early 2019, when he was quoted as saying that those who oppose a Palestinian state should support the transfer of funds to Gaza, because maintaining the separation between the Palestinian Authority in the West Bank and Hamas in Gaza would prevent the establishment of a Palestinian state.

Oct 7th is the direct result of a policy to keep Palestinians out of a two-state solution, it's the direct result of Netanyahu's politics play.

[0] https://www.timesofisrael.com/for-years-netanyahu-propped-up...

[1] https://www.jpost.com/arab-israeli-conflict/netanyahu-money-...