The two sentences are both so called volitional forms.
こよう is 来よう, and the volitional form of 来る. The whole sentence is interpreted as "Let's go to the place where we can brush our teeth and let's return after finishing the tooth-brushing".
If you want to omit the phrase meaning the return action, you would say it like "歯磨きしに行こう".
I think the sentence 1) is a command to the kids because the teacher (?) doesn't intend to go to sleep with the kids at the same time, on the other hand the sentence 2) is not a command because the teacher intends to go together with the kids to the place where they can brush teeth.
As for the use of volitional forms, the article titled " The Japanese volitional form (~しよう、〜しましょう): much more than just “Let’s”" here may help you a lot.
I think the Use 1 and Use 2 in the article may solve your question.
Use 1: When making a suggestion to one or more people which includes oneself (“Let’s” / “Shall we”)
Use 2: When making a suggestion to one or more people which doesn’t include oneself.
You can use the volitional form even if the speaker is not included in the action.
By the way, I think you know there is an opinion here that is against the use of the term "volitional" easily.