I'm wondering if this would have any impact on performance at all, if done right.
document.getElementById('flarum-loading').style.display = 'block'; is run directly on the page so it runs at the very first possible moment, I don't think it would be wise to move it to a file.
But if the code was changed so both app and language are in the same external file, then all this bootstrapping code could be embedded in that file as well.
Maybe a first step could be to move everything except
app.boot inside one of the external files. It's really only the boot that needs all the other dependencies loaded before running.