I can't disagree with you at all, though I don't necessarily share the same level of contempt for javascript. The thought of creating a "new" and "fixed" language to replace it brings the xkcd comic on standards to mind (#927).
I would argue there is a justifiable reason. Before I do bear in mind I accept it may not be a good reason, or one without workarounds, but hindsight makes both of those much easier to see than in the day to day development.
Backwards compatibility. The two words which really haunt web developers everywhere, on so many levels. We don't want old sites to break in new browsers, or new sites to break in old browsers, so fixing major issues of such magnitude would require at a minimum a unique version that could be differentiated from older sites. And when was the last time you saw a version of javascript specified in a websites code?
So then a situation occurs where we could use the new code and "do it right," but we would need fallbacks for old browsers. Or, we could "do it wrong," only use the old way, and development would take significantly less time. While over time the new way likely would win out, it would be a long and drawn out process taking enough developers and managers putting their feet down and saying, no, while this will take more time, cost more money, for the exact same functionality, it is the right thing to do for the future of the language. And getting their bosses to accept that tough sell.
The above seems very similar to HTML5 and IE6/7 support. And how long has that fight been going on?
So yes, one would think the flaws should be fixable, but looking at it from an in the moment perspective as opposed to through the lens of history, it isn't completely incomprehensible as to why they still exist.
Another thought that just popped into my head, is for the majority of the life of javascript, it was used by web developers, many of whom would by todays standards be much closer on the spectrum to "my nephew who designs websites" than a software engineer. It wasn't until much more recently that it began to heavily be used by engineers who pushed the limits much further and ran into these problems. It makes me curious on when the first documented case of these issues was brought up. Was it 20 years ago, or maybe only in the last 5?