With some help from a friend on Discord, I found the solution!
For some reason the changes to the file system were flushed to the IndexedDB right away in my test project, while that wasn't the case in my main project.
I read this link multiple times on my search, but always discarded it as not being the solution.
It was the solution.
All I had to do was adding
[DllImport("__Internal")]
private static extern void JS_FileSystem_Sync();
to my code and then calling JS_FileSystem_Sync() after finishing up the writing.
I'm gonna leave this topic up in case someone ever runs into the same problem.
If a moderator decides that it's better to delete the post, feel free.
You can also lock it if you want, I won't be needing further assistance here.