The risk of speculative updates to branch predictor and page tables was known to the research community for a while. Even if it was initially an unintentional bug, they had plenty of time to take precautions against it by prohibiting speculative updates.
The fact that it did the protection domain check later in the process was not documented by Intel at all for example.
Having said that, the implementation was (obviously) available for Intel engineers and they didn't spot the problem in 10+ years.
Bugs will happen, especially this kind of bugs that people generally haven't had in mind in the past.