There's an old thread that touched upon this but seems to have been forgotten.
The issue is 2-3 years old.
Steps to reproduce:
1. Make a queue/playlist
2. Start playing
3. Cast to a Chromecast-enabled device
4. Wait for playback to finish
5. After the music stops, the homescreen widget is nowhere to be found
Tested with a Samsung Galaxy S23 Ultra and a Google Nest Audio speaker