Combine this with Chrome enforcing manifest v3 starting at June 2024, YouTube ads will be virtually unblockable on Chrome, even with an ads blocking extension installed because Google will be controlling the ad blocking mechanism used by the ad blocker. They can arbitrarily reduce the max number of the blocking rulesets, how often the extension can update the rulesets, or even elect to skip running any rulesets that target YouTube or Google domains.
I read in a different post that the code was misinterpreted to be a 5 second sleep before showing the video, but instead was waiting 5 seconds to execute some anti-ad-block script. Still pretty sleazy either way.
There's a video going around of a guy using a useragent spoofer to prove that it only does this on non-Chromium browsers. So I don't think it's necessarily anti-adblock, but it could be interpreted that way when you consider Google's plans to implement DRM in Chromium.
When I went rooting around to find it. I figured it was some QA process that starts 5 seconds after the video loads (the timer seems to be async and the code sends a promise off while it waits). Of course, it's all minified JS so it's a huge pain to read.
Facebook for all its nastiness was very much incompetent in influencing the direction of the web. Look at their failed attempts like free basics.
Google on the other hand has the web tightly in its dirty grip. At this point, they aren't even pretending to be nice. Even those plans that cause them reputational damage are brought back in some other name.
The only way to stop Google is for the regulatory agencies to put their foot down hard. They should be divided into at least a couple dozen companies that are not allowed to do business with each other.