And the "software is free speech" argument itself doesn't apply when we are talking about something malicious that is installing keyloggers and transferring private data to overseas servers.
TikTok is not an American citizen. Nobody is preventing American citizens from printing the source code of TikTok on their tshirts so that people can compile it and use it. This is the only conceivable scenario where the 1st amendment would apply.
And even if that was happening, the US could rightfully ban use of Chinese owned servers in the US. Then we'd get what happens in China: a US-owned entity forms to run TikTok in the US. It is now subject to US rules and regulations etc.
Plus, criminal speech can be restricted in any case. If it's determined that the TikTok app is violating the law or facilitating the commission of criminal activity, the distribution of that app could itself be deemed a crime, or even worse for app stores, subject them to civil liability.
This definitely needs a reference.
Distributing software for you to run on your own hardware is speech, though, and it's protected by the first amendment. You can license the distribution of your own software if you want, but you can't tell me I can't give you software if you want it.
Basically: how do you think this would work, in a way that wouldn't also make Linux or gcc or whatever available only at the whim of the government?