I've routinely pulled apart gearboxes, and put it in the ultrasonic clearner. Works magic.
But an electric motor, I have not needed to do. Most just need surface cleaning, and the inners are fine. There not enough parts in there to make it worth doing. I usually blow them out with compressed air.
I'm sure it would work, but you would need to use plenty of compressed air to get all the water out of it....