Wrapping Up
Hoisting is one of JavaScript's quirks. At first, I was annoyed, thinking "why did they design it this way?" Now I just accept it as "that's how JavaScript works." What matters is understanding the mechanism and building safe coding habits around it.
Since that 2 AM undefined nightmare, I haven't used var once. Using let and const gives me TDZ protection, and block scope has nearly eliminated variable collisions. Understanding hoisting definitely cut down my debugging time.
In the end, hoisting is just the JavaScript engine saying, "Let me prep a bit before I start working." We just need to understand that prep process and write predictable code. That's the conclusion I've reached.