When the first iPhone was released, YouTube used Flash instead of HTML5. Safari had special code to play the video with the native player instead of displaying a blank square. I suppose (from the flash-specific detection in the supportsMIMEType method) that this code was in charge of that logic.
Note that while the code was written in 2014 (well after the iphone was released), someone tried to remove the code this year[1], and gave up because some sites now rely on this hack.
The code was added to the public WebKit source tree, but it wasn't written at the time. It was upstreamed from the internal fork of WebKit that Apple used for iOS.