Israel and some Muslim countries (e.g. Syria) have been engaged in a "forever war". Quoting from Wikipedia:
[T]he State of Israel and the Syrian Arab Republic [...] have been locked in a perpetual war since the establishment of Israel in 1948, with their most significant and direct armed engagements being in the First Arab–Israeli War in 1948–1949, the Third Arab–Israeli War in 1967, and the Fourth Arab–Israeli War in 1973. Additionally, Israeli and Syrian forces also saw relatively extensive combat against each other during the Lebanese Civil War, the 1982 Lebanon War, as well as the War of Attrition. Both states have at times signed and held armistice agreements, although all efforts to achieve complete peace have been without success.
Likewise, the relations of Iran with Israel have been under the same mark of non-recognition since 1979:
After the 1979 Islamic Revolution, Iran severed all diplomatic and commercial ties with Israel, and its theocratic government does not recognize the legitimacy of Israel as a state. [...] Since 1985, Iran and Israel have been engaged in an ongoing proxy conflict that has greatly affected the geopolitics of the Middle East, and has included direct military confrontations between Iranian and Israeli organizations, such as in the 2006 Lebanon War.
So how does the UN prohibition against a "war of aggression" square with something like this? If one country doesn't recognize another's right to exist at all (from the beginning or due to a change in policy/government at some point), is there anything in the UN charter that still applies, short of prohibition against crimes against humanity?
Of course, in practice, it depends who is the judge of that, and who can veto what, given how the UNSC is set up.
But in theory, under the UN charter, does non-recognition (sudden or from the beginning) excuse any and all attempts to (say) "liberate" the territory of another country or even to annexate it, given that territorial integrity appears bound to the notion/existence of a state in the UN charter?