I experienced the same thing with a thunderbolt external 5 HDD bay enclosure when I upgraded my 2018 Macmini 8,1 to a 2023 16" M2 Max MBPro 14,6. Not 100% sure if the problem started when I went from the Intel chip to the M2, or when I upgraded my MacOS from Ventura to Sonoma because both happened simultaneously. I just know that it worked before on the old system. The symptoms were... regardless if the thunderbolt cable was plugged directly into the MBPro or external dock, the drives would continually drop after 3ish hours. Only solution would be to reboot the system and start the 3ish hour window again.
*Knock on wood* I have been symptom free for the past week. I have connected my thunderbolt cable into my dock using a USBC female to USBA male adapter. Of course, the usual suggestions of "Prevent automatic sleeping... [On]", "Put hard drives to sleep... [Never]", "Wake for network access...[Never]" have been applied. I purposely have kept my system running 24/7 the past week to try to get it to fail, but as of now I am good to go.
This solution may not be for everyone. An individual I work with has exactly the same 5 bay setup... but with a 2023 M2 MBAir, and the drives drop even with an adapter or USBC to USBA cable. He is now looking at other culprits, like OneDrive, that seems to be hammering his system constantly.