I think, at high level (not being an Ember person at all, so just talking in general), the reason it happens is that Discourse tries to load the file with the .js extension and so there is a javascript 404 error in the console and this causes the Discourse Ember 404 page to fail to load completely (the JS fails).
So, the normal 404 page loads but because it is a JS error (because there is also a 404 JS loading error), it does not render in it’s normal pretty way.
