In my experience, while many people don't like to admit it, useragent detection is still one of the best ways to handle many bugs and edge cases in large applications.
Feature detection works well for new features or well documented failures, but it quickly begins to break down in many edge cases.
For example, mobile Safari shipped a broken implementation of IndexedDB for a while and detecting that was a big pain, but swapping the known bad versions to use websql or localstorage worked great. Edge (pre chromium) had some really weird bug with the JIT and the javascript `.call` function for a bit, but there was no realistic way that I could detect just that bug, so I fell back to useragent detection.
There are tons of bugs that I've found over just the last few years that are due to one bad version, or some specific OS/browser/hardware combo, or are just flakey and hard to trigger with code in the page, therefore they are hard to "feature detect".
I have a feeling the amount of those kinds of bugs that you see and their frequency only gets worse when you have monumentally huge amounts of traffic and users as someone like Youtube does, and while I think we should still hold them to a good standard, I can see why they would fallback to UA detection.
After all, it's better to have a well working experience for most users (even with a subset of the features) than one which breaks 1% of the time (and every time it breaks, like it or not, the users are going to blame the site not the browser).
What we really need (in my opinion anyway) is a way of doing UA detection that is much more scoped to specific versions, and remove the ability for those feature detections to accidentally impact new versions or other browsers (either accidentally or on purpose).
Something like setting the browser name/version to a hash of the version number and a secret for each version, and possibly doing the same with other parts of the UA (like hardware/device name and OS name/version).
Then people like youtube could block known broken or bad useragents from getting some features to avoid serving code that breaks to those users, and then the onus is on them to update their lists every time a new version comes out. There are obviously ways around it (UA checker as a service?), but it at least makes it harder for lazyness to take over.