What is the best way to build a closed loop continuous rotation servo for 3D printer?
You can use a magnetic position encoder.
AS5048B High Resolution Position Sensor
14-bit rotary position sensor with digital angle (interface) and PWM output
14 bit means 16k steps/rotation. With a stepper which does 200 steps/rotation and 16x microstepping, you will need only 11 bit, so you have plenty of extra accuracy you can use to filter noise.
You may use AS5600 Positioning Sensor instead, which is 12 bits, since you don't need to track each microsteps in a closed loop, 4x is enough.
AS5600 in PWM mode does up to 920 Hz, AS5048 1 kHz. I'm not sure in I2C mode but surely more. Of course you have to take into account delay between measuring the position and transmission of the position.