Issue #3439981 by fago, ericgsmith, petar_basic, acbramley: Uploading a file to media library flushes theme registry (cherry picked from commit 7b24d548)