The save location dialog for the media library keeps popping up on its own all the time, basically whenever I do edits in the timeline or when switching back to Final Cut Pro from another application. (Any edits to the library or projects get saved howsoever and FCPX seems to work normally besides this very annoying dialog pop up behavior.)...
That information is stored inside the library package in a file called Settings.plist. The pop-up implies one or more of locations listed there cannot be located on disk. The dialog should indicate *which* of those cannot be accessed. Take a screen capture the next time that happens.
If the above is your actual screen capture, that implies you are using only internal managed media. In that case it should never have a problem locating that.
OTOH the above dialog shows FCPX Backups as "Do Not Save". Since these take up such little space and are so valuable, it's uncommon for people to configure it that way. It's conceivably a bug in FCPX that they never thoroughly tested. I suggest setting backups to a known location and trying that.
FCPX is very sensitive to drive volume names. If your cache, backups, media or Motion content started out with one drive name, then changed to another drive name this could happen. However you should only have to enter the revised name one time. This is if using external storage locations; it should not happen if all those locations (except for backups) are inside the library.
It's interesting you report it only happens with the main user account, not in freshly created one. This could imply a permissions problem. Can you run Disk Utility First Aid on all volumes, plus inspect the permissions of the volume where the library is? Do CMD+I and see if your main account has read/write permissions on the required locations. If that drive volume was ever used for Time Machine backups, there might be a permissions problem.
All media, cache, and backup files for FCPX should only be on HFS+ or APFS volumes. They should not be on FAT, exFAT or NTFS volumes. Verify this is the case. Those can be on a NAS if properly configured but I haven't tested that. If on a NAS like Lumaforge that's specifically designed for video editing, people almost never have problems with that. If on other NAS types, they sometimes have problems.