Sometimes I see Korean people referring to their whole language as 한글, as in "한글학당". But as far as I know, 한글 is just the name of the writing system used in Korean, an the language itself is generally called 한국어/한국말/조선말/조선어. So, why do we see the word 한글 used in such situations? Can I use 한글 as a direct synonym of 한국말?
You made a good point!
As you've said, 한글 is only a writing system, not the language(한국어) itself. But unlike many other writing systems, 한글 was "invented" solely for 한국어, and many Koreans feel very proud about this. Plus, you don't really use 한글 to write down other languages than 한국어.
So most Koreans think of 한글 and 한국어 as the same. Still, strictly saying, it is an "abuse of notation".