Scale degrees are regularly altered (modified), and it sounds like what it sounds like. Now you've heard what this particular modification sounds like, and you'll be able to use that sound in the future, when you want that sound.
An essential element in sheet music notation is accidentals which are used to show alterations to scale degrees. By notational convention, the alterations are temporary and are automatically cancelled at the next barline. This convention is because that's how pieces are usually built. Alterations are temporary, and when they are returned back to normal, that's a kind of a tension/release element.
I wrote a chord accompaniment harmonization for this melody.
To add further scale degree alterations, I made a change in the last bar, making a proper dominant-seventh (G#7 instead of G#m) accompaniment chord fit better with the melody.
Try making further modifications and listen to the new sounds. How about this one, do you like the sound?
Many of the scales and/or chords obtained via alterations have specific names, but I'm not sure if learning a lot of fancy names does more harm orthan good. The names don't matter, only the sound matters and that you know how the sound was made.
What "understanding" means for different people varies. For me, it is enough if I can relate the change to something I consider familiar or conventional. Another thing that helps to gain a feeling of understanding is if I have encountered example pieces where this particular thing is used. What comes to the flattened 2nd in minor, unfortunately I can't name any specific tune from tothe top of my head, but it is very commonly used.
You can also do the same trick in the backing chords, without the alteration being reflected by the melody at all. How about this:
Now there are many more chromatic alterations of scale degrees. During the D7 chord, even the tonal center C# is altered! I don't claim to particularly like this chord progression, it feels slightly weird at places, but you can do that and it sounds like what it sounds like.