Actually, the other cases you mention presided over much more traumatic ends to their Empires than Britain did. I'll leave Spain to one side as it was mainly conflicts with descendants of its own colonists that she fought, much like Britain in the 13 colonies that would form the United States. Portugal - an effective dictatorship at the time - fought a 13 year war to hang on to Angola, causing the deaths of 110,000 civilians; it only ended with the collapse of Lisbon's Estado Novo regime in 1974. Similarly, albeit arguably even more extremely, Algeria was not just part of the French Empire, but legally part of France itself. The French fought to retain Algeria from 1954 until 1962. Algerian historians tend to estimate the deaths there as around 1,500,000; French historians usually significantly lower, around 400,000. But what is not in doubt as this does not compare at all with the British Empire, which all but peacefully dismantled itself in the 1960s. Harold Macmillan signalled this loudly and clearly in 1960 with his 'winds of change' speech in S. Africa; he saw African colonies as ready for independence and as future allies in the struggle against Communist tyranny. But the British knowledge that Empire was not forever predates this by some decades. Canada, Australia and New Zealand had already begun their journeys toward self-governance before the reign of Queen Victoria ended and this was formalised with the 1931 Statute of Westminster. Concerning the rest of the Empire - colonies that did not have a white majority - the equivalent declaration came just a decade later during WWII, with the Atlantic Charter. This agreement between the UK and US set out among other things a path toward the peaceful dismantling of the British Empire and embrace of the Wilsonian ideal of self-determination. That this was agreed to by Winston Churchill, who had (in?)famously been an outlier even within the Conservative Party in his foot-dragging on Indian independence, shows that even the old romantic imperialist himself could detect the winds of change. Even Disraeli had complained of the colonies being 'millstones round our necks' way back in 1852 and predicted their inevitable independence. So it just isn't accurate to finger Britain as having the 'winner take all' attitude toward Empire; if anything, the opposite is true.
For you to compare modern Britain to Putinist Russia is simply laughable and perhaps reveals your true agenda. The UK is among rather few allies of the Ukrainians who have unambiguously held fast to that Atlantic Charter principle of self-determination, and the Ukrainians with their feting of British PMs and monarchs have made clear their appreciation of this. We are likely to see another, cultural iteration of this next week in the Eurovision Song Contest.
The United Kingdom knows what it is; we stand in line with our history as the most steadfast opponent of aggressive, absolutist and arbitrary government. From Philip II of Spain through Louis XIV, Napoleon, Wilhelm II, Hitler, Milosevic and now Putin, whenever a tyrant threatens us or Europe, we will be there to face them down. Thank you for the advice, which I'll assume is in good faith as it's Sunday, but we won't be needing it. God bless you, and liberty.