How much does Celestron charge for a replacement motor/encoder assembly?
I'm afraid it is fairly expensive nowadays. You would need to ask them.
If you saw the very fast motion - it was probably either when first turning the system on, or when doing a goto slew. I never saw it happen when it was simply tracking at slow speed - which is evidence the encoder is working fine - and that higher speeds trigger the problem.
The failure modes for the encoder itself are mainly accumulated dust and debris - and possibly a weakening of the LED. I don't recommend it - but you can pry open the encoder and look at it - as I did. It looked pristine - and I was even able to clean the LED and sensor a bit - but all with no benefit. And the encoder itself is not intended to be replaced. There is a very tiny, tiny hex grub screw attaching it, and there may also be loctite involved. I don't think it can be removed and replaced without extraordinary measures - but again I don't think the encoder is the problem.
Separate from the encoder, the motor itself has at least one semiconductor element that I believe is the culprit in this situation. My impression is that the motor lifetime could be extended and the likelihood of a runaway could be decreased - by reducing the max slew rate via custom rate 9.
If you do get a new motor, it is fairly easy to exchange it - as mentioned above.
If things are working for you now, they may be fine for some time. And reducing the max slew rate may extend it even further.