Lots of them have fiduciary duties, meaning they’re legally prohibited from doing anything that doesn’t maximize the value of the stock from moment to moment.
Overall, I agree with you that stock price is their motivation, but the notion of shareholder supremacy binding their hands and preventing them from doing things that they want to otherwise do is incorrect. For one, they aren't actually mandated to do this by law, and secondarily, even if they were -- which to reiterate, they aren't -- just about any action they take on any single issue can be portrayed as them attempting to maximize company value.
https://pluralistic.net/2024/09/18/falsifiability/#figleaves-not-rubrics