I have been using Apple products for almost 20 years now. I usually have the entire library shuffling while i'm working. It seems random, although it seems to only do it while in the mini player window. I usually have the "Playing Next" expanded down to the bottom of the screen and sometimes it will knock the shuffle off once it gets to the bottom of that, other times it will go a couple of hours before knocking it off. There are over 28,000 songs, although i don't see how that should make a difference with the specs i have.
I have noticed that if i shut the shuffle off, then put it back on as soon as i open the app and press play, it seems to take.
I Just bought a new MacBook Pro in December and the issue has been going on from the day i got it. I am on Catalina 10.15.7 (19H512). 32 GB of memory and 773.8GB available of 1TB storage