In addition to the possible causes you already identified and eliminated, another that has been reported is having one of the folders the IDE uses during compilation on a network or cloud drive.
A quick check for this can be done by putting the IDE in portable mode:
That's not perfect because the compilation is still using the temporary folder, but at least the sketchbook and data folders will then be under the portable folder you created.