I am having a similar issue with iPhone XR, running the most current iOS, and AirPods. Occasionally when I take out my AirPods the Music app will sort-of launch and start playing music. When I say sort-of launch, I mean that when I swipe up to shut it off the Music app is not one of the open apps. I rarely use my iPhone to listen to music, so to shut it off I have to dig into a folder where I put the music app, open it and then turn it off. This whole scenario is extremely frustrating. I know I am not in the majority of not using my phone for music, but instead use the AirPods and iPhone to watch videos.
The closest answer I have found for this is to turn off the AirPods auto detection, which will pause and play content when the AirPods are removed from or inserted into the ear. I like this feature because I have children who can sense when I am doing something that is relaxing and enjoyable to me and immediately find cause to interrupt it. However a number of times I will put the AirPods back into my ears and the Music app will be playing a song from my Library. To me these are 2 distinct features and users should have control over them, which apparently they do not. This also occurs with my car, though not as frequently, or at least I may not notice it, since my car radio input is not automatically changed. Meaning, that I am listening to FM radio, ,and the bluetooth input may be playing music but I don't notice it. Not sure about this, may test this more in the future.
So, this function is not specific to the AirPods or CarPlay but must be an overall function within the bluetooth setup, similar to how the iPhone keeps automatically turning on bluetooth after I shut it off. At least it's not playing that horrible U2 song anymore.