YouTube uses their own player (AVPlayerLayer) likely to match their other 'YouTube for TV' apps on smart tv's, cable boxes, consoles, etc etc in form and function.
Or since it seem to drop AirPlay coming out of an AD it could be something to do with the audio route temporarily disappearing causing it to route back to default. It seemed like it either revert to using system audio (directed through ATV) vs media audio (directed to wherever its pointed). However after I reconnected a couple times as usual I was going to try to diagnose the issue a bit I could not get it to mess up again. Performance of YouTube on the ATV AirPlaying to an AirPlay 2 speaker is usually completely unreliable.