> Does this phenomenon of reflecting back *exactly the same phrasing* that the questioner used have a name?

There is a phrase [オウム返し][1], which refers to something like saying "Spent 125 million yen!?" right after someone says "I spent 125 million yen". But 行きますか and 行きません are not "exactly the same", so you cannot use this phrase in your situation.

> I'm having difficulty understanding why the teacher felt it was necessary to add this phrase to the conversation.

In general, when you are asked a question, it is preferable to give the most direct answer. For example, if someone asks you, "What time is tomorrow's flight?", it might not be wrong in reality to answer indirectly with something like "If we leave here at 8, we'll make it in time" or "I'll wake you up when it's time". But it wouldn't be surprising if someone pointed out that such an approach is not ideal, at least for writing practice. You should say "9:30" first, and then add whatever you want to. This kind of thing is a basic tip for writing clear and easy-to-understand sentences, regardless of whether you're writing in English or in Japanese.

In your case, the question is basically a yes/no question, so you could have started your response with either はい/Yes or いいえ/No, and that's the most effective way of making your answer sound clear. Technically, starting your response with 'No' may be "redundant", but you wouldn't say that's a bad habit, would you? Likewise, saying どこにも行きません is another good option here; it answers the question directly, and to a native speaker, it's not long enough to be called a "mirroring" at all.

  [1]: https://jisho.org/word/%E9%B8%9A%E9%B5%A1%E8%BF%94%E3%81%97