Modern shareholder law is definitely a strange business. People have successfully brought suits for a variety of bad-but-not-illegal causes. There were a lot of lawsuits about sexual harassment and climate change, I believe the theory being that “bad thing will make the stock go down, and the company didn’t disclose that they might do the bad thing”. Then more recently a lawsuit against target proceeded (I don’t see whether it’s completed yet) despite target
having disclosed the risk (in this case of their DEI activity).
The claim in the suit is notably that the company failed to disclose the behavior, not that they did the behavior (Target notwithstanding), which mostly agrees with your line of questioning.