I was thinking about that yesterday, but handoff does not seem to be part of AirPlay protocol.
As soon as I turn off my iPhone, playback from a video stream (safari, youtube app) stops as well.
aTV connection to internet may be required for authentication. It has always been for HomeSharing (iTunes account auth seems to be involved), but AirPlay pushed from device should not. Might have changed in 12?
Perhaps authentication is he issue. However, this goes back to the Apple TV 3 which I bought specifically because it was supposed to enable direct streaming over Airplay from a device without being connected to a network. What I discovered is internet based content would not stream without the ATV being connected to the internet. So my experience is mainly based on pre-iOS 12.
My reaction to your comment about the stream stopping when you turn off your iPhone makes sense to me, since the iPhone is the de facto controller, even if the burden of streaming from the internet is being handled by the ATV. In the same way, I might assume the ATV remote is controlling the phone, rather than the ATV, and perhaps it is. But when I turn off the ATV, it likewise stops the iPhone. All that is to say, I’m not surprised that the reverse is true as well.
I have not looked at the code, so I’m just guessing here based on my observations. If there’s no handoff protocol in the AirPlay code, then obviously this is impossible.
What I do know is that up until iOS 11.4, I could stream from the internet via AirPlay from my phone, and that stream would continue whether the phone screen turned off, or if I pressed the power button to turn it off. After that, it disconnects in those events. I believe some video Apps which are streaming via AirPlay will continue even after the screen has been turned off. I haven’t really tested it thoroughly since upgrading to 12 but I’ll give it some effort and see how I currently observe it to behave.