The WHATWG community has discussed the inconsistent behaviour of
<script defer>, that should wait for stylesheets being loaded as per the spec but no browsers other than the legacy version of Microsoft Edge had done it. This problem was causing a flash of unstyled content (FOUC) on various websites particularly in Firefox.
Firefox 76 has solved the issue, and deferred scripts, including modules deferred by default, will be executed after all stylesheets are loaded. Web developers need to expect inconsistent rendering behaviour until the change is implemented by other modern browsers.