It gained popularity in corporate governance since then but it’s not a legal requirement it’s a shareholder preference. But that preference is violated all the time.
People often cite a 1919 era case from Henry ford because it has a pithy statement but the court in that case explicitly upheld many of the decisions Ford made that violated the principle.
That is, there is no law or precedent that requires corporate officers to only consider shareholders.