Up until the court decided to start ignoring centuries of legal tradition that is the bedrock of our legal system and threw out stare decisis the decision was actually more secure than a specific law.
Any law codifying it can be challenged on many grounds, especially the 10th amendment. It could easily have been struck down as unconstitutional because the federal government has no power to pass a law affecting this issue, since the constitution doesn't grant it.
Only a constitutional amendment would have been likely to survive a court willing to do what this one has done, and there is zero possibility the Democrats could have passed one.
Not when, in a universe known to contain non-organic beings able to perform tasks like smuggling plans, a gunnery officer decided to save lasers (as though they were apparently a precious resource) and not fire on an escape pod with no life signs? I feel like that would be the most appropriate moment to stop taking Star Wars seriously.