It is most definitely a problem of the app. I have never seen an app actively playing media being terminated by iOS. That’s really disruptive for the user, and Apple usually protects the user experience from stuff like this. But do to this, the app has to correctly communicate to iOS that it is actively playing media.
The upside of AirPlay is that it works with everything. Chromecast needs to be supported by the service you want to cast so the phone can hand off the connection to the Chromecast (something that AirPlay can actually also do, at least for video). But if an app / service does not support it, using the device as a streaming relay is the only way to enable casting of basically everything.
Used SE would be my way to go.