I updated my 2018 mac mini to monterey 12.3.1 and started getting the disk not ejected properly error too. Tried everything I could find here on the internet and nothing worked. I had been running a WD 4TB hard disk formatted for Time Machine use and it had been working perfectly for several years. After exhausting all the remedies here I decided to VNC into my mac mini and see what that login looked like. To my surprise I got NO disk errors at all. I then logged into my mac using the root login and again no disk errors. This ruled out cable and hard drive issues and pointed back to the user account. I spent a day and half deleting cache files and resetting pram and nothing cured my disk not ejected properly issue. So what I did to fix my machine was made a complete current backup with time machine then setup a new user account with admin rights. I logged in with the new user and deleted my original login account. I shut down and restarted my mac in recovery mode and reinstalled monterey. Once monterey was reinstalled I logged into my account and used migration assistant to restore my mac with the backup I had made. The backup restored my original login account which purged whatever was causing the disk not ejected properly error. Once I was able to login with my original account and verified all my files were intact I erased the second user account I had setup. So far it been 24 hours and the computer has went into screen saver and shut the power off the monitor several times with out any errors.
Hope this helps others as its helped me!