I'd think two costly and destructive wars probably had more to do with the collapse of the European empire.
The moment the colonialists saw the colonies as free money, they were fucked. Which was ca 1870. After that is was just a matter of time. Once the liberation movements got rolling, there was nothing to stop them.
At the beginning of the British empire in India they treated the natives with respect. Ambassadors would dress like Indians and go out of their way to learn customs. The Brits didn't start out racist. Quite the contrary. After Darwin's book came in 1848, social darwinism became all the rage, and especially white supremacy. After that they didn't give a rats ass about fairness or treating any Indians or Africans with respect. It was all about enriching Brits at the expense of the browns. That didn't even work in the short term. Instant fail. The result was that England stopped making a profit from their colonies. While England was focused on free trade, and non-exploitation, it made England rich. But as soon they started just sucking out blood from their colonies, England stopped making a profit from their colonies. In 1960 England was losing money to the colonies... just because bleeding them dry had destroyed the infrastructure. Both social and physical. This was a trend started decades before the world wars.
What the two world wars did was to make England bankrupt. So they couldn't afford to pay for the colonies. But if they'd just managed their colonial holdings responsibly all along, the colonies would have been an economic boon, to both themselves and England. So it would have been in their interest to keep the colonies.
It wasn't even greed. It was just idiocy. It was the idea that economic rules suddenly didn't apply any longer and the Brits were so rich and powerful they didn't need to care about anyone. What a surprise that went to shit.
There's loads more details to this story. But there was a lot wrong with the British mindset, that brought down the colonies. A huge problem was that it was low status to work. Gentlemen didn't have jobs. They went to clubs and smoked cigarr's and drank whiskey. They looked down their noses to American millionaires who continued to build company empires even when already rich. The result is that the most capable entrepreneurs continually took themselves out of the jobs market = a dumb cultural strategy. While the American economy rapidly overtook the British economy. There was a culture of making it rich in the colonies and then coming home to England to live off your wealth. Bad for England. Bad for the colonies. The British army was idiotically organised. There was little incentive to do a good job, or effectivise anything. So they didn't. It just became a massive drain on the economy.
It was just so much wrong with the British empire. And it was one of the better ones. France and Holland were even worse. The only colonialist that held out for any length of time was Portugal. Why? Because they were fascist. They had no free press and were totalitarian. But the moment the fascist dictatorship fell, the colonies broke free. After Belgium the worst colonial power by far.
I've read quite a number of books on British colonialism. There's a lot of things to say. it's a complex topic.