Yes they are legal, and I'm not sure I follow the argument that they shouldn't be
But at the same time, it's definitely legal, for better or for worse, as is pretty much any stunt you pull with the joke that is US IP law.
I'm not aware of a country that requires you let people sue you in this sort of situation, or requires that you not terminate their contract if you do.