There are many good obvious reasons to accept a better job at a non-competitor, or a strong competitor, but on the surface, going to a struggling competitor seems odd.
It is worth exploring. One thing that keeps coming up in my mind is that Google is regularly mentioned in context of anti-trust stuff. That is a big deal. I honestly wouldn't be surprised if Google bigwigs sent Ms Mayer to Yahoo with a blessing, saying "make Yahoo good again, we need competition". Conspiratorial sounding, yeah sure. But at the same time, completely reasonable, and totally explains what would look like an otherwise conflicted loyalty/position.
A strong yahoo also helps (everyone really) on the Facebook front.
A strong yahoo also will keep Google sharp. All of their best innovations came when they weren't the clear winner, so some competition may help invigorate the innovation again.
I wouldn't put it past Sergey and Larry to grok all of this, and say to their trusted people, "look its better if some of you guys move to our competitors, it's good for all of us, you guys can actually make that happen."
Besides, maybe she really believes she can turn the company around - who will be laughing if/when that happens?
I'm sure Marissa's departure was considered a huge loss at Google, especially to go to Yahoo. No company is ever happy to lose an executive.
To be fair after reading a bit more and thinking about this it could be a vanity move motivated by the promo skip.