Keeping in mind that my overarching contention is that Israel can not occupy territory to which it has sovereign claim...
Israel has the right to protect itself from attacks, even to the extent of using military armed force. This is true for occupation or against foreign enemies. I fully agree that a state can not exercise control and claim self-defense against a foreign enemy at the same time. IF a state is attacked by a foreign enemy, it declares self-defense under Article 51 (and other law). IF a state is attacked by citizens of an occupied territory, the claim is not self-defense (because, by definition, they are already the victors). I need to repeat - either way - the state has an inherent, inviolable right to protect its territory and its citizens from attacks and that right includes the right to use force, including military force.
Here's my point: in order to be an occupying force, the occupier must have control over the territory. Israel demonstrably did not have control over Gaza post-2005. Israel did not control the government administration. Israel did not control security or policing within Gaza. (Two key qualities of occupation).
Here's how we know with certainty that Israel did not control Gaza: 22,000 rockets, weapons smuggling of unknown quantity, 700km of tunnels exclusively for military use, foreign terrorist-trained soldiers, children trained for combat roles, military campaigns such as October 7. If Israel had truly had control over Gaza, none of the military infrastructure could have been built, let alone used effectively against Israeli citizens. Israel would have prevented it through monitoring and inspections and would have charged, tried, and imprisoned those found guilty of terrorist acts.
This demonstrates that the territory was not controlled and therefore not occupied.