There are a few ways that you do to achieve your requirements.
But you have to disable Apple’s SIP which I don't recommend personally.
So, I would suggest you use this third-party application named as Mac Media Key Forwarder. Use the latest version 3.0 for Catalina.
You can prioritize which app you would like to control or you can go
with the default behaviour which controls the running app. The app
runs in the menu bar.
Download the app and move it to your Applications folder. Double-click to start it and you will see a black dot appear in your taskbar. Click on the dot and make sure that the option to start on session initialization is ticked. Then change the option to give priority to Spotify over Apple Music for your media keys.