I wonder isn't this a big problem worth talking about?

Personally, I don't think so.

You have some undefined setpoint that you are trying to make some undefined system meet, using some undefined measurement to determine how close you are to the target.

Some specifics are really in order.

The only time you need to switch the direction is when the actual value has one sign and the setpoint has the other sign. The direction does NOT necessarily refer to the direction of rotation of the motor.

Suppose that the setpoint is 3000 RPM, and the measured value is 3020 RPM. The error value will be -20, but that does NOT mean spin the motor 20 RPM the other way. It means slowing the motor down a little bit. If the measured value is 2980 RPM, the error value will be +20, which means speeding the motor up a little bit.