If a major website starting blocking user agents for any reason other than compatibility then all that would do is trigger (finally) the deprecation of user agents strings as browsers would all just pretend to be each other.
But none of that means that the war somehow can't or won't occur.
Firefox uses Gecko instead of Webkit. They can't change their user agent string.
It's difficult for me to envision how that's rigorously enforceable to prevent something outside of the app (like a browser) to access something ultimately consumed by an API without resorting to (expensive and crackable) digital rights management at the hardware level. You can run down whatever train of thought you want, but ultimately since the client is running on machines controlled by the consumer, it can be cracked, reverse engineered, decapped, or whatever. This has been the end state for every attempt the industry has made to control user behavior. DVD CSS, Bluray, Sony's CD rootkit nonsense, every game console, satellite TV cards, analog cable TV, on and on, all broken.
I'm confident google/youtube wishes there weren't applications like FreeTube and yt-dlp. The fact of the matter is it's practically impossible to exclude them but still keep their own ecosystem functioning at an acceptable cost and with consumer buy in.
Even if they whitelisted Safari, that would still be actionable.
They're not being forced to provide a service for free, they're not being allowed to ostracize essentially the only browser with any meaningful percentage of users that doesn't use their web engine as that is an anti-competitive and monopolistic practice.