Israel does good intelligence work. Why do you think they didn’t have some better info before the Oct 7th attack?
Because their focus was on Hezbollah and Iran. They thought that Hamas was under control, with bribes from Qatar, etc. and that Hamas served a useful purpose in countering the influence of the PA.
Hezbollah was seen as a much greater threat, and that’s where they directed the bulk of their intelligence resources.