Imo is so simple to use a front camera as hardware sensor...
They can't use the camera as a hardware sensor as it uses a lot of power, not necessarily the sensor itself, but the imaging system on the SoC needs to be powered up, and it is a lot of data being processed just to try and use it as a proximity sensor.
True proximity sensors use a pulsing infrared LED and an infrared sensor, and the infrared bouncing back from something in close proximity can be detected, and this is very reliable.
Because the screen only has a small hole for the camera with narrow bezels, the proximity sensor has to be placed behind the OLED display, and Xiaomi for some reason has not gone down this route on this device. It is possible to have a normal proximity sensor behind the screen and for it to be tuned to work, as many devices do this already, but perhaps for cost or licencing reasons or to save space behind the screen they have not done this.
As far as I'm aware, the proximity sensor is a virtual sensor by detecting if the phone is held vertically, and using an Ultrasonic sound from the speaker being picked up by the microphone, it attempts to work out if near a face or not. If you hold your phone such that it isn't vertical against your face, the sensor will likely assume the phone is not against a face and so will not turn off the display.