K.M.
I've struggled with this too, and have had several dismaying incidences with my own children (ages 5-girl, 3 and 1-boys). Unfortunately my daughter had her innocence violated at age 2 1/2 by an older boy at the library and thankfully was able to tell me about it. So I've had lots of these conversations, in part because I've found that her own boundaries about her private parts are not firm. My husband assures me that this "exploration" is normal, and that it's also important to teach our children healthy boundaries about their private parts.
I explain to them that, while toys are meant to be shared, bodies are not. Your body belongs only to you and to God. Nobody else. Private parts are especially special, and not for sharing. I like how you gave your child instructions on what to do if someone, adult or child, exposes private parts--leave immediately, and tell a trusted adult. When they ask why, so far I've just explained that a vagina leads to the womb where babies grow so it's a very special place. And that penises are very special (no you may NOT touch your brother's!) because they allow men to be Daddys. Sometimes I go on to say that private parts are very important and special, because they are the parts of our bodies that God uses to give us families, our most precious gift. I think later I will build on this to explain sex as a loving act that bonds a husband and wife and provides children, but for now I leave it there. (Of course, parents and doctors help children and babies care for their bodies until they are able to care for their own).
I think you handled the situation very well. Having been in a similar situation, I only regret the panic I felt, though I tried to be calm and firm for the sake of my children.
These are big issues. The important thing to convey to our kids is that they are loved, their bodies (and other people's bodies) are very special. The skill they will hopefully learn is how to treat their own bodies and others' with respect.
All the best to you!