I'm aware there is a similar question about this: Bremsstrahlung vs energy conservation
However, I don't think the answer given actually answers the question, so I'll ask again:
Let's consider a high velocity electron passing close to a nucleus. As it moves away from the nucleus, it loses kinetic energy whilst increasing its electrical potential energy by the same amount.
There must be something missing in my understanding about the formation of bremsstrahlung. If all the electron's loss of kinetic energy is converted to electrical potential energy as it leaves the nucleus, where does the energy come from to create a radiated photon?