I didn’t manage to reproduce the MBID issue.
Tried loading folders and files with the setting disabled, then tried again with it enabled, then tried changing the setting while loading and all of them worked as expected. Not sure if I missed something.
The changes made to speed up reading the settings could cause this kind of error, but I’ve debugged line by line and didn’t catch anything wrong.
Based on the testing, I think it is more likely to be either file errors, duplicates that doesn't get loaded or invalid MBIDs.
Edit: trying to use the file browser exposed the issue.
See code changes in pull request #1575 submitted by Gabrielcarvfer.