Why wouldn't the countries where these batteries are currently developed decide to heavily tax the export of these batteries to Tesla thus offsetting any net economic benefits of the Gigafactory? Though there seems to be enough competitors where this wouldn't be a problem.
There's more than one country involved in exporting these batteries. If only one country would tax exports, they would lose market share to the factories in other countries.
(Then add WTO restrictions on top of that. Thanks to the WTO!)