It was Simchat Torah, which is a festival day in Israel so their guard may have been expected to be lower, it was a weekend, so more soldiers would be home with their families and fewer people would be at work. Some people have suggested that the timing was related to normalization talks between Israel and Saudi Arabia (basically peace talks between nations that are not actively fighting each other).
Hamas is closely aligned with Iran, and Israel and Saudi Arabia are its two most powerful regional rivals. Cooperation between them is a threat to Iran’s dominance. The same goes for the Houthi group in Yemen and Hezbollah group in Lebanon.