Here we engage in doublespeak, so common when dealing with Israel - where the terms may have different conventional and legal meaning, and even the latter may be disputed by different sides:
Occupation
From 1967 to 1981, the four areas were administered under the Israeli Military Governorate and referred to by the United Nations (UN) as the "Occupied Arab Territories".
[...]
Despite the dissolution of the military government, and in line with Egyptian demands, the term Occupied Arab Territories had remained in use, referring to the West Bank (including East Jerusalem, which Israel effectively annexed in 1980), the Gaza Strip, and the Golan Heights. From 1999 to early 2013, the term "Occupied Palestinian Territory" was used to refer to territories that the interim governing body of the State of Palestine, the Palestinian National Authority (PNA), controlled in the West Bank and the Gaza Strip.
The International Court of Justice (ICJ), the UN General Assembly, and the UN Security Council all regard Israel as the occupying power for the territories.
[...]
The Supreme Court of Israel has ruled that Israel is holding the West Bank under "belligerent occupation". According to the Sasson Report, the Supreme Court of Israel, with a variety of different justices sitting, has repeatedly stated for more than four decades that international law applies to Israel's presence in the West Bank. However, successive Israeli governments have preferred the term "disputed territories" in the case of the West Bank, and Israel likewise maintains that the West Bank is disputed territory.
Israel unilaterally disengaged from the Gaza Strip in 2005. The UN and a number of human rights organizations continue to consider Israel as the occupying power of the Gaza Strip due to its blockade of the territory; Israel rejects this characterization.
As Arab-Israeli conflict is to some extent a continuation of the proxy-conflict between the USSR and the US, Russia obviously adopts the position that favors Palestinians, but the fact that the State of Palestine state is not universally recognized still casts a shadow on the applicability of the usual conventions regarding occupation. Note also that Russia entertains relations with Hamas, which is considered as a terrorist organization by the US and the EU.
State of Palestine
Note further that the State of Palestine is not equivalent with a Palestinian state - there are different visions of what the latter means, but the former is more or less well-defined (leaving aside the border negotiations):
The areas claimed by the State of Palestine lie in the Southern Levant. The Gaza Strip borders the Mediterranean Sea to the west, Egypt to the south, and Israel to the north and east. The West Bank is bordered by Jordan to the east, and Israel to the north, south, and west. Thus, the two enclaves constituting the area claimed by State of Palestine have no geographical border with one another, being separated by Israel. These areas would constitute the world's 163rd largest country by land area.
In other words, Gaza lies in the State of Palestine, but the territories attacked on October 7 lie in Israel... from the point of view of what is internationally viewed as the State of Palestine, but not from the Hamas point of view (a Palestinian state from the river to the sea, see also Hamas 2017 charter.)
Palestinian National Security Forces vs. Hamas
Israel is not fighting the State of Palestine, but fighting Hamas. Indeed, Izz ad-Din al-Qassam Brigades are not a part of the Palestinian National Security Forces, but rather in conflict with these latter(see Battle of Gaza, Hamas-Fatah conflict). In other words, Hamas is a non-state actor, just like Hezbollah is a non-state actor in Lebanon.
It now seems that, under assumption that Gaza is the occupied territory of the State of Palestine, the International Humanitarian Law gives Israel right to deal with Hamas, regardless of whether we consider the territory occupied or not:
The occupying power must respect the laws in force in the occupied territory, unless they constitute a threat to its security or an obstacle to the application of the international law of occupation.
The occupying power must take measures to restore and ensure, as far as possible, public order and safety.
What can be reproached to Israel is that it takes lightly its responsibility of protecting Palestinians from Hamas, and otherwise assuring their safety. In theory Israel should be defending both from Hamas.
Remark
I foresee an objection that Hamas received majority in 2006 Palestinian legislative elections. The obvious objections are:
- the elections concern only the political wing of Hamas, but not Izz ad-Din al-Qassam Brigades
- Hamas was allowed to form the government as a majority party, but not as a sole party; they also defied the authority of legally elected president - in other words, it doesn't make sense to consider legality of Hamas rule in Gaza within the legal framework of the State of Palestine
- Otherwise Hamas electoral mandate would have expired in 2010 or 2011.