Easy fix for this is to clamp the pinion in a vice then place an old allen key onto the motors shaft and gently tap it with a hammer to push the shaft out of the pinion. Any of the other suggestions may damage the motor at least this way all that will get damaged is the pinion

Or as otherwise suggested a pinion puller but its one of those tools you will probably only use once.