Again, through much experience with this issue, many get on this track that it's sleep functionality but I don't think so. I suspect it seems to be sleep because the time we let our Macs sleep is a LOT of time. Whatever actually causes this problem then has lots of time to occur. When we re-wake the Mac after many hours and see the unexpected ejection, we jump to a conclusion that sleep is the cause.
I suspect that's not true but just coincidental. For example, OP describes it happening while actively rendering a HB file to the drive. Obviously, neither Mac nor the drive can be asleep during active writes. All other variables like cable, specific enclosure, user settings, etc are the same. I've experienced the same when using externals as scratch drives for FCPX: both Mac and the drives are definitely awake. If the cause is sleep, those examples don't allow sleep, so it seems sleep is NOT the cause.
However, if someone still believes it's sleep, unhook the same drive cable from the Mac having the problem and hook it to a Mac running macOS before Big Sur. Put that Mac to sleep a thousand times. Set it up to sleep and wake at exactly the same time as the new Mac and leave it alone for a few days. You will very likely find there is no "unexpected ejection." I can do that trick myself: unhook the problematic drive from "latest & greatest" Mac, hook that same cable to an older Mac running MacOS < BigSur and that drive is perfectly stable again... as it was for a few years while I still used that Mac and- BTW- let it sleep every night.
My best guess is that macOS (BigSur and newer) ports "crash" and reboot and some enclosures handle this better than others... including some enclosures from the same manufacturers. I'm convinced Apple needs to go in there and debug the code.
Else, (I think) those of us experiencing this (which is MANY) are chasing red herrings when we head down these popular paths of tweaking settings, installing an app to keep the drive awake at all times, etc. No tweak seems to "stick" for all. What is common to all is macOS (since BigSur).