It makes sense, as a country you wouldn’t want US companies taking over your social media. It’s only alarming from a US centric view.
Not having to build your own Facebook (and WhatsApp, etc.) means that you can build something else that can (eventually) compete internationally.
China isn't being irrational here, but there is a tradeoff between growth and security.
So banning the big tech companies is kind of protection against this, as US influence can be really toxic for local businesses. Even the EU starts to fight back against them.