Of course, the international community can condemn treaties and push for decolonialization, but in most cases this is foiled by the refusal of the colonial power to give up the claim. Examples: Falkland islands, West Sahara, Goa (reconquered by India using military force).
In many cases, it is advantegeous for both parties to seek a peaceful decoloniazation treaty, which becomes a part of international law and formal basis for the future claim on the decolonized territory.
In practice, colonial era treaties are less legitimate. No one except the parties directly materially affected care.
This appears to be a difficult argument to make in a consistent way. HK was ceded to GB a the Treaty of Nanking[1] which was between the UK and the Qing Dynasty Chinese government. It was later expanded in 1897, again with the Qing Dynasty.
That Dynasty collapsed in the early 20th century. That was followed by the warlord era, and then the nationalist government in the 1930s. That lasted until defeated by the Communist government in 1949.
So there were only around 20 years the Nationalist government governed mainland China, and it was long after the treaty ceding HK.
This is true, but it doesn't make a strong argument for legitimacy. Former governments flee countries frequently, and unless there is a rapidly implemented plan to try to get them back into power they are generally ignored.
Taiwan is better viewed as a breakaway state than having any legitimate stake in the government of mainland China.