Ok, I’ll admit I did not read this entire thread but I did want to chime in. I work on Variable Frequency motor drives (VFDs) all the time at work. Usually pretty big ones but the principles are usually the same.
The high pitched whine or chirping is caused by the way the VFD controls the motor. The VFD rapidly switches the outputs on and off swinging the voltage from rail to rail of the DC bus (~170VDC on a 120V drive, 325V on a 240V drive). This occurs many times per second at the carrier frequency. This is almost always 4kHz. The pulse width is modulated to generate the desired waveform to the motor. This high change in voltage (dV/dt) generates electrical and mechanical stress in the system. On the control board, the actual switching elements (IGBTs) might make noise, but commonly it is the windings in the motor mechanically vibrating at the carrier frequency. Better quality motors whine less.
Most drives allow you to select higher carrier frequencies (8 and 12kHz are common) to reduce audible noise at the expense of increased motor and drive heating. This is done especially in elevators and HVAC since the noise would be bothersome in an office setting.
Your lathe sounds particularly bad, could be a cheap drive or something else. Hope you get it fixed.