It's questionable whether such a law is actually enforceable, and I'd hope it wouldn't hold up in court. That said, I can't blame Musk et al. for being worried by it.
Being unenforceable doesn't stop a state from passing it (see AB5 recently with most industries getting exceptions). And once it passes, it posses serious business risk to operate in that state.