The power reversal has to do with the torque opposing the angular velocity, rather than acting in-line with the angular velocity. That is what happens, once it crosses its equilibrium position, and starts coasting "uphill" against a magnetic torque that tries to bring it back to the equilibrium position. Torque dot product angular displacement switches from being positive to being negative. This means energy is leaving the mechanical domain and it must be going somewhere, during this time. Neglecting friction and resistance, it would go in to the electrical circuit as a generator.
Suppose the permanent magnet's field points due north. If the electromagnet's rotor also points north, it is at a stable equilibrium. Whether you disturb it to the left, or disturb it to the right, it will return to pointing due north.
Now suppose we start it such that the electromagnet rotor's magnetic field points west. It begins to rotate clockwise, with a clockwise torque. Electrical energy is turning into mechanical energy. We agree so far.
Once it passes north, where it would otherwise remain stationary, it coasts past north, and continues spinning clockwise. The torque is now acting against its rotation. Energy is leaving the mechanical domain, and entering the domain of electromagnetism, as it spins against the torque that tries to align the magnetic fields. This is where you are missing my point. Because it is slowing down, its kinetic energy has to be decreasing. That kinetic energy has to go somewhere. One destination for where the energy is going, is the friction and parasitic losses in the electrical circuit. Another destination for the energy is that it is entering the electrical domain, during a time when the motor is temporarily acting as a generator.
The rotor will come to a stopping point, once it gets to pointing east. It will then turn around and start speeding up again. Energy leaves the electrical domain, and enters the mechanical domain. The cycle continues, and it swings like a pendulum from west to north to east, and back to north. If you give it enough of a push so it can spin all the way past the unstable equilibrium at south, it will continue rotating. It will speed up as it rotates clockwise on the west side, and it will slow down as it rotates clockwise on the east side. Or vice-versa, if we spun it counterclockwise. If friction were eliminated, it would continue spinning indefinitely, speeding up and slowing down in cycles.
This is why we have to reverse the direction of current in the half of the cycle when it spins from north to east to south. So that the torque on the rotor continues to match the direction that the rotor spins, in order that the electrical domain and magnetic fields always do positive work on rotor, rather than flip/flopping between positive work and negative work.