If it's been happening consistently for a month, you're likely dealing with a failing disc drive sensor rather than a software glitch. The disc ejection mechanism has a sensor that detects when the tray is fully seated, and when that sensor gets dirty or starts degrading, it can trigger random eject commands. Before you assume it's totally dead though, try one thing the others might've glossed over: boot into safe mode and rebuild your PS5's database. Hold the power button for about ten seconds until you hear a second beep, then select "Rebuild Database" from the safe mode menu. This occasionally fixes sensor read errors that a standard restart won't touch.
If rebuilding the database doesn't work, you're probably looking at a replacement disc drive unit or sending the console in for repair. One important thing to watch out for - don't keep testing it repeatedly by inserting discs and waiting for it to eject again. Every failed sensor read can stress the drive mechanism more, and you might end up with a stuck disc that's harder to retrieve than a repeatedly ejecting one. If you're still under warranty, Sony's repair is your best bet. Otherwise, disc drive replacement kits exist online, but they involve opening up the console and require some care to avoid damaging other components.