China does not ban YouTube or Instagram because they're foreign, They have some very onerous rules about censorship, which I disagree with, but are applied equally to all companies operating in China, including Chinese ones.
A good example is that google is banned but bing is not, and tiktok is also banned in China because they don't follow those laws.
That's the sanitized on-the-surface naive explanation of why China wants to control the social media (and search) landscape. The 'laws' you refer to are that Google was required to take down things that were unfavorable towards the Chinese government. So quite obviously the Chinese government simply doesn't want to be undermined by foreign entities, right?
This isn't too far from the US governments motivation to not have it's political power undermined by a foreign entity, and the propaganda situation is different between a democracy and an autocracy. It's politically impossible (and would be inconsistent) to ask specifically TikTok to remove all political content that could either bolster support from one party, or detract from another, as the US has the tenet of free speech enshrined in constitution. But instead of making up some nonsense law that social media companies must yield to coarse-grained censorship by the government, the US are at least being honest about their intentions.
A good example is that google is banned but bing is not, and tiktok is also banned in China because they don't follow those laws.