There was a similar issue with many G4s years back.
The usual cause was an attached USB item, somehow sending or reflecting a signal during boot which the Mac interpreted as a Mouse-down signal. A Mouse-down signal during boot is an instruction to the Mac to eject all removable media - hence the tray opens.
The USB device in question could be most anything, often a tablet or a dongle or even an iMate adapter; in many cases a USB printer was the culprit.
Perhaps something like that is at play here. If this is the case, the only way to determine which item is doing it is to test via trial and error. Start with none - if the tray opening ceases, then you know its one of the additional items usually connected, and can spend extra time finding which it is. Once you find which one is doing it, one possible solution is to isolate it via a self-powered USB hub.