Google and Facebook were banned long ago in China - if anything these actions are retaliation for that.
Apple has been allowed in but has had to divest all data hosting to Chinese controlled companies.
This is a point most people seem to forget. In simpler terms it's retaliation - granted they could have done this a long time a go? maybe... but right now there are other interests at stake as well.
Google wasn't banned. They pulled out due (primarily) to requirement that they censor search results.