It doesn't need to be a habitual action, though that could be one reason it's used. That's why I included the interpretation "Why do you go and hide on me like this?" (I'm not sure if that English expression, which is somewhat idiomatic, makes sense to you.) Also whether she's "surprised" or "annoyed" doesn't really enter into the situation. The point is that the focus isn't on "Why are you currently in the state of doing this?", but rather "Why do you do (things like) this?"
You'll also see this with phrases like どうしてそんなこと言うの? ("Why do you say things like that?"). なんてことしてくれるんだ, and so on and so forth. Obviously, in actuality whatever has been said or done has already been said or done (otherwise, the speaker wouldn't be reacting to it). The use of the imperfect isn't saying that it literally hasn't happened yet, it's just the way the speaker is framing it. The idea isn't "Why did you just now (in this one instance) say or do that thing (that you've already done or said and won't do anymore)?" (which is what the nuance would be if you said どうしてそんなこと言ったの?) but "Why (as a general rule) do you say or do things like that?"
This isn't to say the perfect tense versions aren't possible, of course. The point is that just because an action might still be in progress, that doesn't mean that's the only way it can be perceived/described.