Mrs. Dubose says this to Scout who makes an attempt to sound friendly with "Hey, Mrs. Dubose." Mrs. Dubose is a sickly, older woman. She is in pain, refusing pain medication, and is generally uncomfortable. This manifests in a grumpy disposition (attitude). She is also a traditional southern lady. In this southern tradition, there are so called "proper" ways of addressing people, including the proper ways a child should address adults. When Mrs. Dubose scolds Scout in this way, it says more about her grumpy demeanor and adherence to southern tradition than Scout's attempt to be friendly. Note that when Atticus passes, he says "Good evening, Mrs. Dubose" because he knows she expects this type of greeting. So, what a young lady "should" say is actually subjective. In other words, it depends upon the person, the generation, and/or the culture. For example, if Scout says "Hey, Miss Maudie" in the same friendly tone, Miss Maudie would respond in kind, with a friendly "Hey, Scout."
Atticus teaches the children to consider the perspective of the other person. Knowing Mrs. Dubose is a grumpy, traditional, southern lady, Scout would know to use a more formal greeting. Knowing how easygoing Miss Maudie is, Scout is perfectly fine using a "Hey" greeting. Different greetings can and/or should be used in different situations.