Capitalism and Corporations
Corporations only exist to make profits. That's literally their only goal. They usually produce a product or provide a service, but that's just a means of gaining profits.
So of course Amazon, Google, and Microsoft will take on these tasks, the governments are paying after-all.
Why do these companies bother doing business in places like China in the first place? Money. There's money in China and they want it. There's no universal law that says every company must operate everywhere. Google could just as easily leave the Chinese search engine business to Chinese companies, and not bother with the hassle of filtering their results. But if someone is going to make money off of search, it's going to be Google (according to Google).
So condemning a corporation for seeking profits goes against the very nature of capitalism. You might as well condemn the Sun for shining.