I've had this problem for a long time, for as long as I've had my Chromecast, if memory doesn't fail me.
I open Spotify on my Moto G4, connect to my Chromecast (2nd gen), start playing something, and it's OK, I can control the volume. I know for sure because volume is always at 100% after connecting, in a possibly related and equally annoying issue. Volume control works fine for a while, with app in background or foreground.
After a while, I can't control the volume anymore. Cast icon disappears from the list of audio devices. Even with app in the foreground. If I close the app and open again, it often restores the control. But then goes away.
I think I usually can still control the song playing, but not the volume.
I'm making a new-year resolution of finally moving away from Spotify if I don't see this fixed soon. Gotta be with someone who really loves me, I'm too old for this.