I have no doubt what you say is true. But how come a CEO doesn't get fired every time a corporation donates to charitable causes? How does such an action "maximize shareholder value"?
It has PR value, so they can do it in moderation. They tend to focus on doing things like supporting the arts (which benefits and is visible to the shareholding classes), more than doing things like helping starving kids in Africa (who are fairly invisible to the shareholding classes).