At the root of it, it's always done for the shareholder.
That is not true. Shareholder value as an economic goal was pursued relentlessly by Jack Welch while he was CEO of General Electric. It's been more than ten years since he said that “the dumbest idea in the world. Shareholder value is a result, not a strategy... your main constituencies are your employees, your customers and your products. Managers and investors should not set share price increases as their overarching goal… Short-term profits should be allied with an increase in the long-term value of a company.”
It should be pointed out that from a shareholder perspective, GE went from $60 to $11 in the face of external technological threats. Shareholder value is the idea that you can't roll your money back into R&D because it doesn't have any immediate benefit, far better to declare a dividend and keep the people who own your shares happy.
Tesla, for their part, gives no fucks about their shareholders. They have been rewarded handsomely for it.