I think a lot of people misunderstand the rules around this... There's a fine line that many developers walk, but Apple has long allowed core hardware and OS functionality to be unlocked via IAP as long as it's not the only thing being unlocked. The idea is that a developer can't just blatantly make money off Apple's work.
Here's the relevant portion of the App Store review guidelines:
However, lots of third-party apps do this, even from many smaller developers, so Google isn't getting any special treatment here. This has also been the norm for years. Push Notifications were a very common one in the early days — dozens of apps charged for this, but they did so indirectly. The key rule was that it was fine to enable Push Notifications as part of a paid tier as long as that tier included other stuff; developers simply couldn't charge a payment or subscription solely to enable a feature that Apple had already provided.
YouTube Premium easily falls within these rules, as it's a long-standing subscription plan that provides a lot more than just PiP. Folks made the same argument when Google locked background audio support behind YouTube Premium in iOS 4, but it was the same situation back then. Google wasn't charging to unlock background audio, it was simply doing so as part of a paid tier that offered ad-free listening and other benefits.
Not that I agree with what Google is doing here — I think it's patently absurd that it's taken it almost seven years to support a feature that Apple introduced in iOS 9. I chuckle these days when I think about how many folks used the word "finally" when Netflix added PiP support in June 2016.