I wouldn't say it's the only reason. H264/5 are not royalty-free codecs. YouTube is a powerful tool Google can use to push a royalty-free codec, much like Apple used the iPhone to push people off Flash. It's one of few areas I agree with Google being heavy handed.
It's an open source, royalty free codec. I'd much rather use that than one owned and licensed by a private organisation, no matter whether Google develops it or not.