I'm having this problem after I "upgraded" to the M1 Pro MacBook Pro. The disks got randomly ejected like crazy. It almost always got ejected after been woken up from sleep, and sometimes ejects itself even if I'm actively using it (like copying files). I'm 100% certain my disks / cables are not the culprit because I still use them on my old Intel Mac and they work flawlessly. I think this is some hardware driver issue (maybe insufficient current? I have two 5TB external HDDs)
However, after I updated to macOS Ventura 13.4, the issue seem to have been fixed. My two disks are plugged in for a week now without ejecting itself (what a miracle!). I'll need to keep observing to see if this is actually fixed or I'm just somehow getting lucky.