I do have an idea for you to try.
Is it possible that your music player is always in your recent apps?
Perhaps clearing your recent apps would prevent the phone from automatically starting up the music player.
There has to be a way.
Can you imagine if someone put on bluetooth headphones and wanted to make a call, but music started playing first?
There would be thousands of complaints.
The square button on your navigation bar brings up your recent apps, and there appears a 'clear all' button.
Try that, and then connect to the speaker.
If t still happens, then I would try reversing my method of connection- ie. if I normally turn on the speaker, then connect the phone (or visa-versa), I would do the opposite and see what happens.
Finally, if nothing else works, there is another app for you to try.
Greenify.
It is a small little app that force stops apps when your screen goes off.
It can be used manually, automatically, or even both.
You choose what apps you want it to control, and when the screen goes off it force stops them.
There are many settings to adjust the function of the app, and I am quite familiar with the free version as I have used it for years.
There is a FOSS version as well, that gives the app control of the paid version of Greenify (the paid version of Greenify can control system apps as well) and this one may very well be what you need, as it would give you the ability to force stop whatever system app is causing the music player to start as soon as a connection is made to bluetooth.
I will post the links in another post as soon as I retrieve them.