Yes, I think in the life of Jesus, as in the life of all jews, there were several occasions where he became unclean and had to go through ritual purification. This was an important part of being an observant (law abiding) jew. Every time a woman menstruated, or a man received a skin rash, or an emission of semen, or a whole host of other situations, one became unclean and had to be purified.
When raising the girl, I believe he was already unclean because of what happened just before (Luke 8.43-48):
And a woman who was suffering from hemorrhages for twelve years (who,
although she had spent all her assets on physicians, was not able to
be healed by anyone) came up behind him and touched the edge of his
cloak, and immediately her hemorrhaging stopped. And Jesus said, “Who
is the one who touched me?” And when they all denied it, Peter said,
“Master, the crowds are pressing you hard and crowding you!” But Jesus
said, “Someone touched me, because I know power has gone out from me.”
And when the woman saw that she did not escape notice, she came
trembling and falling down before him. In the presence of all the
people, she told for what reason she had touched him, and that she was
healed immediately. And he said to her, “Daughter, your faith has
saved you. Go in peace.”
I believe that power going out was becoming unclean, not a power of healing leaving him (since he would go on right after that to raise someone from the dead). He sensed that he was unclean and needed to go through the purification rituals. Having that sensitivity allowed him to keep the law and avoid any transgression. The purity laws also explain why the woman was hiding and didn't want to reveal herself, as it wasn't a good idea to go around touching people if you were unclean.
I also think this is why Jesus didn't want the crowd to come with him (to save them from becoming unclean):
While he was still speaking, someone came from the synagogue ruler’s
house, saying, “Your daughter is dead! Trouble the Teacher no longer!”
But Jesus, when he heard this, replied to him, “Do not be afraid! Only
believe, and she will be healed.” Now when he came to the house, he
did not allow anyone to enter with him except Peter and John and James
and the father and mother of the child.
This is most likely because these 5 were already unclean with him, the three disciples for also touching the woman (or him earlier) and the parents for holding their dead daughter.
I don't believe he commanded the others to not be there because he couldn't heal the girl in their presence -- he raised Lazarus in front of a crowd. But rather, he didn't want them to become unclean either.