This is a great question, and there's a lot of ambiguity in every-day speech between those.
Honestly, in my experience, we generally just accept the ambiguity and depend on some context to understand what was meant.
I started that sentence expecting to provide a sufficient way of jumping around the confusion, but I don't have one. You could say "...Apple CEO Cook says Cook is gay," but that would probably just make a lot of people think you were introducing another person.
On top of that, there's really no way to determine which person was meant in this case. If "he" meant Steve Jobs--and of course, knowing the story, it doesn't--it would be reasonable to say:
Russian monument to Steve Jobs taken down after Apple CEO Cook says Jobs is gay.
But, again, that carries a different meaning than was actually intended here. No immediate, similar solution jumps to mind for the actual meaning. It's one of those unfortunate cases where it's easy enough to prove that it is the other one, but not that it's not the other one. Always frustrating.
The best solution I can think of involves some restructuring.
Russian monument to Steve Jobs taken down after Apple CEO Cook comes out as gay.
There are a number of variations that could also resolve work in this case, but you see the point.
Long story short, it's just dependent on context. Personally, I don't think that was a well-worded headline because of the ambiguity, even though it would have been resolved by simply reading the article.