The script does most of that, it will check if plex is idle, stop the container, copy the databases to /dev/shm/folder, validate the databases are not corrupted (notify you if they are), use fusefs to mount the ramdisk over the plex database location, and start plex.
It also has protections in place to not mount twice, using the mountpoint command.
The script only puts the database in ramdisk (about 860MB in my case)
after it validates the database, it will copy it to a Last_Known_Good folder, so you should be able to recover from that incase it detects corruption.
Even after all that, the database got randomly corrupted during a massive metadata import. It could have just been something I did, which is why i provided the script, but i will not be using it anymore. The difference was about 5 seconds vs 1 second to start playing content, and i can live with that extra delay knowing my database is less likely to be corrupted.