I mean before they recognized CCP as the new China legally.
The US was never really under any illusions that the nationalists would somehow turn things around in the Civil War after they retreated to Taiwan. Even before the end of WW2 there had been multiple American observers and experts in China who had reported the Communists enjoyed much broader popularity than the Nationalists, and by 1949 the GMD was very obviously overwhelmed.
Before the Chinese entered the Korean War, the US was expecting an invasion by the mainland to finish things off, and the US government had diplomatically indicated that they weren't going to do anything about it. Only when the Chinese entered the Korean War did the US send the 7th Fleet to the Strait of China to prevent the invasion. They also began to provide the Taiwanese military with equipment and weapons.
After the war the US certainly hoped that the CCP would crumble, but their support of Taiwan was based on denying the CCP territory, and especially on keeping China's UN security council vote out of the hands of the Communists. There was no real belief that Taiwan could attack the CCP.
The US began doubting when they realized how corrupt and inefficient Chiang Kai Shek was. Under Chiang's rule, China was fragmented and regionally ruled by warlords. Chiang often rejected American advice and left America very frustrated. China was also extremely poor with very few rich elites in contrast, which allowed a leader like Mao to come in and gain a huge following.
The US Government began to see the CCP as a capable ruler of China due to its military successes. The Korean War and Vietnam War showed the US that militarily, the CCP was indeed capable of maintaining its sovereignty and was highly adept at military strategy, effectively using techniques like preemption. Under the CCP, China was also united in a true sense and finally closed off foreign influence which originated from the European powers carving up China. Mao was also not shy from War with the US. When Mao had no nuclear weapons, he stated that he was not afraid of the US going to war with China. Also under Mao, the Chinese economy was steadily growing.
Obviously the US did not want to close of itself from the most populated country in the world which was showing signs of revival. Even though it was aligned with Taiwan, it realized that a new solution needed to be made. Hence the two china policy, which allowed the US to maintain its ideological alliance with Taiwan, while also acknowledging that the CCP was the new ruler of China.
Source: On China by Henry Kissinger