I've done this 50 times before (10 times in this project!) and these kinds of issues still occasionally occur. How does anyone predict for this kind of thing?
Just because you're wrong sometimes doesn't mean you can't be right more often than not.
Another way to look at it is, as a company how can you budget anything if you can't make even the slightest of estimations?
What you're suggesting results in throwing away any ability to budget, roadmap, coordinate, etcetc. Absolute prediction is of course impossible, but if what you're saying is true than I should buy a lottery ticket because my estimations are insanely lucky.
And sure, I get estimations that run long, we all do - I'm not saying otherwise.
But to clarify: You can't predict things well that you haven't done before.
The point being, when trying to predict an unknown it's best to give a range and not a fixed estimate. If possible.
I'd argue you can't.
Right now I'm working on a feature that I estimated as 'a couple of hours'. I've been working on it all day by now. Not because the feature is that difficult, or because I didn't get a set of good requirements. The requirements are crystal clear and should be easy to implement.
The reason it's taking so long is that I'm fighting with a UI component that doesn't behave as expected (or documented). What should have been a trivial part of this task, a matter of seconds and not worth estimating at all, turns out to take all day because I didn't know this specific component is misbehaving and I couldn't have known until I started implementing it.
You cannot predict things like that without doing it.