>what moral obligations do corporations have beyond following the law and trying to provide the optimal product to their consumers?
Corporations have no such morals. They are profit seeking social constructs. Breaking the law is often a profitable cost of doing business, as is making an ever increasingly shitty product when there is little to no competition.