Companies can iterate on their products much faster if they're not required to publish all of their functionality as public APIs. Once the APIs have been published, it's much harder for them to be changed.
Doing this also puts them at the mercy of whether or not client applications are willing to support their new functionality. Maybe YouTube wants clients to adopt some feature, but a powerful client application doesn't like that feature and so won't support it.
The protocol/platform lock-in is a problem, but preserving companies' ability to iterate quickly on features is also very important.