The logic is that if a company wants to operate on that country, they have to have local employees, who are liable for the company following the laws. It makes it near impossible for global companies such as Google and Facebook to hide behind "no local presence, won't follow your crazy laws, and you can't ban us because people need us and will be pissed at you".