Like many people with confirmation bias you don't understand the ruling of Dodge vs Ford.
https://en.wikipedia.org/wiki/Dodge_v._Ford_Motor_Co.
It doesn't legally mandate that directors of a company only purpose is to uphold stockholder value, but instead that they don't actively undermine it. It still gives them a wide latitude in how they run their company, and thereby profits/dividends shouldn't and/or can't be the sole measure of a public company's performance or success.
Ford had publicly stated that his intentions were to under serve the stockholders in favour of his personal/company goals. And that was the action that the court ruled on. If he had never said it chances are the court case would of never happened.
Secondly it isn't a law, it's a ruling. It applies to the specific case and sets a precedent for future rulings that come before the Michigan court.
No one other than the Ford motor company had to abide by the ruling. If another company's stockholders in a different state felt they were being mistreated by their executives in the same manner they would have to take them to court as well.
Of course that case would have to take into account the previous ruling but wouldn't be bound by it. To strengthen the precedent it would need to go the the Supreme Court and have them rule positively on it. The legislative branch would have to make it law if they so choose to, and then and only then it would make executives legally bound.
The big kicker is tests of the principal ruling seldom go to court for a number of reasons. Executives were ruled to be "duty bound" not "legally bound" which means they simply need to try to the best of their abilities, which is very hard to disprove.
As well executive compensation has been changed so that, due to the tax laws in regard to making more than 1 million in income per year, they now receive much of their compensation in stock and stock options. This places their emphasis on increasing the stock prices making the ruling moot in most cases.
TL/DR Executives of public companies are not legally but duty bound to always keep stockholder value in mind as they run the company. But have enormous latitude in how the do it, and as long as they can show they're are making their best efforts in this regard aren't disregarding any rulings on the matter.