To get the pinion lose, you don't necessarily have to try to knock it
away from the motor ;-)
I'd hold/clamp the motor with the pinion facing up and give it a tap with a hammer, making sure the back of the motor shaft was supported and making sure I only hit the pinion.
That will probably loosen it so it just falls off as normal hopefully