A humiliating defeat doesn't necessarily mean loss in a cataclysmic conventional war. It could be a Vietnam-style guerrilla war in a colony against rebels backed by rival imperial powers, especially as nationalism emerges as a potent force.
Here's a thought:
China's modernization programs are more successful. A large industrial base is built, as are railways and telegraphs. The Chinese education system is revamped to introduce more science and technology content. None of this is a threat to imperial powers, since China is too weak to threaten European colonies and Asia, and European banks are major investors in these programs. The Chinese government shrewdly plays off all imperial powers while recognizing a need for unequal treaties as sources of investment.
During this modernization program, nationalism emerges as a potent political force in China. Calls for the nationalization of foreign railways and cancellation of treaties increase. By now (say it's 1900) the Chinese government is wealthy and confident enough to peacefully negotiate the cancellation of most unequal treaties (fat compensation, preferential investment rights, etc). To everyone's surprise, even Russia agrees to revoke its unequal treaty. Only Britain holds out, becoming ever more intransigent as anti-British protests and riots spread across Chinese cities.
An incident, somewhere, leads to all-out war. British troops march onto Guangzhou from Hong Kong ostensibly to protect British citizens. Soon, Beijing orders a retreat from the entire southern coast which is blockaded by the Royal Navy. It knows it can't take on the RN.
Seizing the initiative, Germany, Russia, and the US all funnel weapons to China both by land and through North Chinese ports. Japan plays a careful game between hoping Britain loses to preserve its independence while not wishing to be dominated by a victorious China. Japanese ships deliver weapons to China depending on the war situation.
The British troops face a brutal guerrilla war, which it can't leave for fear of losing prestige. The Chinese propaganda war also goes well, with global opinion increasingly isolating Britain. Many American Sons of the Revolution even fight alongside Chinese, wiring heroic reports back home. Though relatively few British boys are sent away, many Indian men are conscripted, breeding resentment.
N years later, Indian troops preparing to leave for China in, say, Singapore, mutiny. Bad stuff happens afterwards.
Britain concedes in a face-saving way. All British influence in China is abolished in exchange for token reparations. But the Chinese have one more lethal blow to make.
The army built by the Chinese originally intended to fight Britain is diverted to Yunnan, where it marches into Burma. Within a month, Rangoon, cut off from India proper by the mutiny, falls to the Chinese. Burmese independence is proclaimed and a new pro-Chinese puppet king is installed on the throne. British Malaya falls afterwards to a flotilla of Chinese and "leased" US warships.
With Burma and Malaya lost and India in open revolt, the British Empire is in deep crisis. Germany responds by sending weapons to Egyptian rebels, with constant strikes along the Suez Canal and riots in Cairo and Alexandria.
There. I destroyed the British Empire. All without a major cataclysmic war.