If you mean throw away all the Yamaha electronic/electrical parts except the motor, then all you need are the three motor phase wires (wire lead 3 4 5 in your diagram) and the 5 way connector marked encoder at the bottom in your diagram, which are the hall sensor wires and their power supply. It is just a brushless motor like any other, so those wires will connect it to an ebike controller in the same way as the big wire coming out of a hub motor.
Ok, no off the shelf controller is going to work with the torque sensor. You could try endless sphere to see if anyone has tried what you want to do, but chances are the answer will be no.
An option to get the torque sensing work with a generic controller would be to use cycle analyst additionally.
There is a controller available that can handle torque sensor as well, https://aliexpress.com/item/1005002711701202.html. It seems suited for Erider torque sensor that outputs 1.5-3V, so if OP's torque sensor output is same, that is another option.