You probably don't know that Google and FB's ads businesses in China are kinda huge, they never left despite the ban, in fact you can still access a special version of Google Maps, their Analytics and Ads both are fine in China.
Chinese apps, games and e-commerce have always been their customers.
As for Tiktok, it was spending like crazy on big platforms at the time, and the product didn't seem popular back then, so why not take that sweet money as much as you can.