Because if their enemies win they aren't "spreading themselves thin"You're looking at the China of the present. In the past its nuisance value was Iran ²² . Check out their role in the Korean War where they nearly defeated the UN Army under the US command or the support they extended Vietnam in the wars against the French & later the US.
Practically all the communist movements in SE Asia essentially & a few in Africa were sponsored by Beijing. Things ceased only after Deng came to power & was tasked with re building the shattered Chinese economy.
He went to Singapore & was dazzled by what he saw there requesting Lee Kuan Yew to help out who promised to do so if China ceased assistance to all these communist groups operating in SE Asia.
That's how China came to withdraw herself from world affairs & focus on trade & commerce, the little border war they fought with Vietnam notwithstanding.
Why should they get involved in Israel vs Iran or Ukraine vs Russia? If their enemies & potential enemies are busy either warring or spreading themselves thin like the US & the West, it suits their agenda fine.
They are the barbarians at the gate.
They were already on their east sitting on their coastline. If Iran falls they will be on southwest sitting on the all of most productive oil and gas fields on the world. And importantly in Iran the only country in that region that was completely independent of the the US.
If Russia falls?