That is true about fiduciary duty. However, there is still no legal requirement to maximise profits at all costs - this is a lie that is constantly trotted out. The fiduciary obligation of a company is generally detailed in its constitution (or other formative document) - for example in NZ there are companies whose constitutions explicitly state that they may on occasion make decisions that are not in the best interests of the company OR shareholders, where it will benefit only tribes of indigenous people.
Basically, a company's obligation is to state upfront how they manage funds (e.g. in their prospectus), and it's your responsibility to Do Your Own Research.