No it had nothing to do with Firefox writing files. Firefox was making a bunch of calls to VirtualProtect. Windows Defender (MsMpEng.exe) was then writing to file (an sqlite database) every time one of these calls was made, which was slowing down the system.
This comment is a good summary of what the issue was once they understood the problem: https://bugzilla.mozilla.org/show_bug.cgi?id=1441918#c82