First, MacArthur had already lost command. Marines stopped taking orders from MacArthur the day before the Chinese attacked at Chosin and Kunu Ri. Within 48 hours after that, UN allied commanders and all but one US division commander stopped taking orders from MacArthur.
Second, MacArthur ordered the Pacific SAC Commander to drop atomic bombs in North Korea. Yes, you read that correctly. He ordered the SAC Commander to launch a nuclear attack. SAC, of course, refused. Mac told them he had written authority from the White House and the Pentagon, but that it would take time to locate. Fortunately for the world, SAC did not believe MacArthur.
Didn't know Dr Strangelove was a documentary, did you?
After SAC's refusal, MacArthur locked himself away for a time. He probably didn't even know the troops in Korea were no longer taking his orders. Because he wasn't issuing any. I would say it was extremely lucky that Ridgeway was already en route when everything fell apart. But it wasn't luck. This did not come out of nowhere. Ridgeway was en route because the Pentagon had too many reports suggesting MacArthur was bordering on outright insanity.
When you get down to it, Truman did not actually fire MacArthur. He just took care of the paperwork after the Generals in Korea fired MacArthur. Or after MacArthur walked off the job as both things had already occurred.