On the matter of the MH17 shootdown, I think there's a confusion about the capabilities available to militants in eastern Ukraine, as well as the capabilities of most surface to air missile systems. The operators of the system in question were probably not in contact with a larger air traffic control network or even linked up to a local air search radar. The radar on the launcher vehicle itself is really designed only to target an aircraft. In most air defense setups, the Buk system included, the launcher is only one small part. A separate air search radar is supposed to bear the burden of locating and identifying potential targets. There is no way for the operator of the missile launcher to contact the target airplane. That's not supposed to be their job.
I would imagine that even if there is a way for the Buk launcher operator to identify a civilian IFF transponder code, it could easily just be a warning light a poorly trained operator could ignore. You can get a sense of what you're looking at from this article: https://medium.com/war-is-boring/dont-think-russian-rebels-can-learn-how-to-fire-an-anti-air-missile-try-this-simulator-8dd9e323ed12 . The only way to "improve" this from the technical standpoint is to combine all of the parts of the SAM system into one vehicle, which is not really possible. The real problem is insurgents getting their hands on these things and not having the benefits that come along with national air traffic setups and professional militaries. Thankfully, the complexity and resources required to operate these kind of systems generally make them unattractive to insurgent groups.
Also, regarding 9/11, the biggest reason the aircraft weren't shot down is that the attack was essentially the first of its kind. The "normal" procedure for hijackings at the time was understood to involve flying the plane to some desired destination where the passengers would then be released or to a neutral destination where the passengers would be held hostage in exchange for ransom demands. This has also explained why the passengers on the first two planes did not attempt to overwhelm the limited number of attackers, because they did not believe their lives were necessarily in imminent danger. After 9/11, the US military started up Operation Noble Eagle, which is provides a much more responsive air defense setup for these kinds of incidents in the future. The US Army deploys SAMs in the Washington, DC area as part of Noble Eagle. 9/11 dramatically changed how the military responds to hijackings.