Unions took to the streets—and the courts—to try to keep Elon Musk’s initiative out of the Labor Department.