The ICJ decision mentioned by Albanese was taken in the (2004) case of the West Bank wall. I think Albanese overinterprets that ICJ decision as applying to the present circumstances in Gaza. Here's what it said (court summary):
Self-defence -- Article 51 of the Charter -- Attacks against Israel not imputable to a foreign State -- Threat invoked to justify the construction of the wall originating within a territory over which Israel exercises control -- Article 51 not relevant in the present case.
Furthermore, even if you do consider Gaza as occupied territory still (despite the Israeli ground troops withdrawal in 2005), then Israel has the right to conduct counter-terrorism or counter-insurgency operations there. As e.g. the US did in Iraq after their invasion, before formally turning over the gov't to Iraqis. Such operation are not prohibited by international law either, and in the practical dimensions they were a quasi-war too with air-strikes etc. The UN charter generally chalks off such matters as "internal affairs" under article 2(7).
If you want the almost funny version of this, the Russian ambassador took a similar position to Albanese
“The only thing [the West] can muster is continued pronouncements about Israel’s supposed right to self-defense. Although, as an occupying power, it does not have that power,” Nebenzya said.
He cited a 2004 advisory opinion by the Hague-based International Court of Justice (ICJ), which states that Israel cannot invoke the UN Charter’s article on the right to self-defense when acting against threats from occupied territory.
But then he immediately added
“We don’t deny Israel’s right to fight terror, but fight terrorists and not civilians.”
So one may apparently fight terrorists anywhere, incl. occupied territories (he didn't say Israel may not fight them there), but just not call it self-defense. (I guess Israel could call it a special anti-terrorist operation, to please the Russians.)
Also recall that after Bataclan, France invoked article 42(7) [common defense] of TEU, claiming it had been attacked by the IS. The legal international status of the latter has been pretty unclear--a self-declared state that nobody recognized, but which occupied substantial territory and against which a lot of countries fought against militarily. (And the analogy with Bataclan is quite appropriate.) That also didn't stop France from treating the Bataclan attackers as pure terrorists.
Essentially, "self-defense" has a broader vernacular meaning than article 51 of the UN charter as interpreted by the ICJ. You can self-defend [in the vernacular sense] against terrorists or insurgents or separatists in your own country (or occupied territories) even if that is not what the ICJ construes to come under article 51. So, [international] lawyers can quibble about the exact word to apply to Israel's armed response, but that makes little practical difference as to whether the response is permissible.
Perhaps instructive here is the French statement from 2019:
In accordance with ICJ case law, France does not recognize the extension of the right to self-defense to acts perpetrated by non-state actors whose actions are not attributable, directly or indirectly, to a State.
France has, in exceptional cases, invoked self-defense against an armed attack perpetrated by an actor having the characteristics of a “quasi-State,” as with its intervention in Syria against the terrorist group Daesh (ISIS/ISIL). However, this exceptional case cannot constitute the definitive expression of recognition of the extension of the concept of self-defense to acts perpetrated by non-state actors acting without the direct or indirect support of a State.
Is Hamas-in-Gaza a quasi-State these days? Probably. Anyhow, the US takes an even more expansive view on the right to self-defense against non-State actors. From the latter's viewpoint, it's probably enough to view Hamas as an armed group that attacked Israel, and the Palestinian Authority being "unable or unwilling" to control Hamas. So, there's little surprise the US doesn't make such extensively qualified statements (like France did there.)
FWTW, there is a 2nd/pending ICJ case wrt OPT. The UNGA request is broadly worded. We'll see if the ICJ treats Gaza separately/differently. But events on the ground might well overtake any court opinions.