Technically yes. Google also.
The caveat being they expect data and servers etc to be present within China and unlike the EU don't allow data to leave China. The penalties are also much much higher.
There are also rules around applying censorship and other requirements, not dissimilar from operating in Thailand, Vietnam, India and probably other markets but those are the 3 I'm very familiar with.
Google previously was happy enough with this arrangement but eventually pulled out. They had very poor market penetration, Baidu then (and now) enjoys a near monopoly on search similar to Google in the US. I imagine that was the key reason rather than the rules themselves as they operate in other very restrictive markets without complaint.
Facebook would have an awful time trying to compete in China tbh. The market is just way too competitive with way too many absolutely cutthroat market participants, completely unlike the US market which was pretty much stagnant before TikTok showed up.
These companies don't enter China for the same reason why many companies don't. Domestic competition there is just too damn tough. If your market isn't already in race to the bottom stage in China it always descends into it pretty quickly because of the rate people clone and adopt similar ideas. If you don't have an unfair advantage you need to be very innovative to stay ahead.