How come a YouTube link isn’t transformed into a shortcode inside the post content?

On output WordPress parses the content and finds any links on their own line and for links from supported sites it uses oEmbed to get the embed code for the linked media and replaces the link with it.

It does this with WP_Embed::autoembed(), which is added as a filter to the_content.