The worst mistake that the US can do is to perform a ground invasion of Iran so I don't see much reason for anyone else to intervene.
No one is going to militarily intervene in any scenarios but I don’t understand why some people here are so allergic to even sending material aid. They are acting like China shouldn’t even send anything.
And then you're conflating Ukraine with (potentially) Afghanistan, Pakistan, Tajikistan, or Kyrgyzstan. Russia's frontier with Ukraine is plains and forests to my understanding. China's western frontier is separated from its neighbors almost entirely by mountains, completely unsuitable for heavy armor, trench warfare, or offensive artillery warfare.
If an US army pops up there then they are still a problem for national security. Would it not be more preferable to not have any US or European soldiers next to Western China.
If your fear is instead a flood of terrorism into China through those border crossings, that's an entirely different problem than having a "Ukraine" on their hands. Given the last decade's struggle to secure Xinjiang, I suspect that would be the kind of "war" China is now more than ready for. Winning the hearts and minds of the Xinjiang population was a big step in that direction.
Why are you gambling with the lives of civilians? China is prepared for such a scenario but why let the situation deteriorate to that point in the first place. I know for a fact that there will be fuming anger if a car bomb blows up in Xinjiang and kills 10s or 100s of civilians. People on this forum will immediately blame China and Russia for doing nothing on the Iran issue in that event.