It's because your headphones were sending a Bluetooth "Play" command on connect (my Honda Odyssey does this as well). For anyone else with this problem, you can override this silly default in macOS using Privacy & Security > Bluetooth, adding Music, then turning off Bluetooth access for Music.
That is maybe questionable behaviour from the headphones. But the worse problem is that there is no way to change what media player is used. I don't use Apple Music, have no songs in it and no subscription. But it opens that rather than the player I do use.
I'm pretty sure I have also launched Apple Music accidentally with some keyboard button or touchbar action. For a "premium" device having to close Apple Music (effectively an ad) a few times a week is not acceptable.