I’m not sure I really get what you are looking for when you say “selfhosted”.
Yes there are self-hosted music platforms, but you bring your own music files.
Maybe you are looking for something like Spotube (available on F-Droid) that let’s you download music (I believe it uses Spotify search then downloads the music from YouTube).
Or maybe you just need to find a tool to download music from Spotify (like zotify) then put them into a self hosted music platform like Navidrome or Jellyfin?