The money was distributed among the workers - which include both people behind the counter and executives like Cook - as the shareholders chose and agreed. Arguably they chose to allocate it like they did (which workers to incentivize more and which less) because they consider that it maximizes their own profit by attracting good workers and motivating them, and they chose to offer Cook a deal that (especially in retrospect) looks very lucrative. Perhaps it was worth it and perhaps it's just gifting him undeserved money - but in any case it's their right to do as they wish even if they spend their money stupidly and randomly give it to someone and not someone else, since all of it (i.e. Apple, it's assets and profits and the value created) belongs to the shareholders, and workers - both people behind the counter and people like Cook - get only what they agreed with the company and thus it's owners/shareholders.
https://fortune.com/2014/03/01/apples-tim-cook-picks-a-fight...