In this sense it's a counter word meaning "piece". In other senses it's a carving/sculpture or the formation of a Cabinet. It's a noun either way. Some other counters act as adverbs. It's not listed in many lists such as https://en.wikipedia.org/wiki/Korean_count_word (but it is here: https://www.koreanwikiproject.com/wiki/Counting_items ) so I rather suspect it's optional on the street, only when you need to stress the meaning, as the equivalent seems to be in Japan. Like when there's a whole cake and you want them to cut you a piece, rather than when it's sold as one already wrapped . . .
It's better to consider them from a grammatical perspective rather than a social one. They are simply part of the grammar of the language, and I don't think native Korean speakers would ever omit them altogether (though perhaps the specific usage might occasionally differ between the formal standard language and colloquial speech). However, if a learner of Korean speaks the language relatively well while intentionally leaving out counting words, I imagine it would be awkward; though if you're a beginner and don't always use the right counter or occasionally forget to use them, I'm sure Koreans would be understanding.
For Korean learners who have also studied other languages that use counting particles, being grammatical does not mean there is no social perspective. Khmer in particular has grammatical counting particles, but there are very seldom used nowadays. Basically the person is asking whether this specific particle is optional or mandatory in this particular example.
There's no dog; here, 개 is a count word. Korean, and many other languages, use special words in conjunction with cardinal numbers and nouns to indicate how many there are of something. Japanese and Chinese have a bunch of these "counters", each for different kinds of nouns. Korean, thankfully, is much simpler, and for now we just need to know 개. If you see a structure like this, where you have a noun like 케이크, a number like 도, then 개, there's no dog; it's saying how many cakes there are.
You really should read the other comments before commenting here.
As other comments have already said, 개 means dog and it's also a grammatical marker used for counting. The usual format for numbers in Korean is "noun number counterparticlecaseparticle", so in this case, 개 is the counter particle, not the word dog.