There isn't really anything like Spotify. There were attempts to use a service like Last.fm (which isn't self hosted) or libre.fm (which is self hosted but development has been stopped) to track your listening data. Then there were a couple discovery projects that worked with Navidrome (don't really remember the name but they're probably somewhere in r/selfhosted) but they haven't been very succesful.
Even if you somehow managed to solve those problems you've got the next problem which is the fact that you don't have the recommended song available in your library. Perhaps it could be solved wit Lidarr.
Personally I think Spotify is worth $10 a month.
The thing is that right now it's not worth it to buy a raspberry pi if you want to selfhost. It is 4 years old at this point but it cost 50% more than when it was released.