Nobody denies its their right, but that doesn't mean it's not a very stupid action, motivated by dumb nationalism. You can't handwave circumstances away, as if the legislators don't know it is a cashgrab against foreign corporations and genuinely believe Google and Facebook are Canadian companies.
They're using this playbook because it worked. Look at China, they were once a big threat to American Exceptionalism or whatever and now... <checks notes>... oh. Nevermind.