To be fair, I think there was a mix of altruism and self-interest with both technologies. Without WebM being a credible alternative, I think we'd have seen H264 licensing tighten up considerably.
And the fact that SPDY was developed unilaterally doesn't take away from Google's generosity in making it available to the world. It's generally well-regarded, and Google haven't attempted to limit it's use by other browsers in any way - much the opposite. Can you imagine Microsoft doing the same when they were the dominant browser?
Again, I'm not saying they introduced either of these technologies from pure altruism. But I am saying I'm glad they exist, and Google's approach to IP is a welcome breath of fresh air (so far).