There are two actors and you're mixing up who is responsible for which outcome. I explained in more detail in another comment
Obviously the Israelis could have just kept their mask on, but Hamas was clearly correct in their calculation that they wouldn't.