Same here. Two Identical Mac Mini, with the same OS, Monterey 12.5.1
In Mac #1 everything is working perfectly, in Mac #2 the same disk eject continuously overnight. Every energy saving, etc is deactivated, I also tried Caffeine and Amphetamine, nothing at all.
When two identical situation lead to different results, it probably means there is some random cause that move something over a threshold. Indeed, looking in Apple -> Information on this Mac -> Hardware -> Usb -> Bus Usb 3.1, the disk Extreme SSD need 896mA of current, while the maximum available amount is 900 mA.
This means that with 2% of tolerance in current, it is perfectly OK that sometimes the current goes above or below the threshold required. This also explain why Apple doesn't fix the problem: it is a hardware one, no enough current available, and thus impossible to solve. In addition, Apple can't admit this because you can't spend 3000$ and have a computer with low hardware specs.
I am going to change SSD disk, and see if it works. Another option could be to change the USB-C to USB-A, hoping that in that case there is enough current to keep the disk powered on.
My 2 Cents.