It's just until early 1900s that a "nationalist" (SiKyeong Ju) decided to use the "phonetic alphabet" into a primary writing system and revamped the system to be focused on words to be identifiable, rather than following the pronunciation. hangul now is just like equivalent of using a modded Phonetics alphabet that made each words identifiable. It's not representing the actual pronunciation, nor the actual pronunciation of the word. That's also the reason why the hanja (= kanji or "Chinese characters" or whatever your country calls it) was around until late 90s.
If you think Korean grammar is crazy, It's all thanks to him.