Decades ago, China did not have the skilled labor force, the technology, or the infrastructure to make such a transition. Selling to the US enabled it to buy / transfer technology, train up its work force, and build infrastructure.
Also, China is ultimately a resource poor country, particularly in farm land (where it just has 8% of the world's farm land vs. 20% of the population two decades ago) and oil (which was much more important two decades ago than today).
Without exporting to the US, it would've been much harder for China to develop since the global resources (and technologies) trade was in dollars. We should not pretend otherwise. China doesn't exist in a vacuum - it has had to compete with other developing countries like India, Indonesia, Brazil, etc. for investments and trade. If those countries sold to the US but China didn't, they would've had a huge advantage in the catch up race and may have displaced China in the manufacturing competition.