As far as I know, there is no "recovery before the actual recovery" as with MiUI. I'm almost certain that there is no way to calibrate these sensors. The driver has some kind of internal calibration routine that can even be triggered externally by writing to certain sysfs entries, but it's obviously not working correctly. The only way would be to fix the driver.
I built the ROM from the most recent official sources (security patch level 2018-12-05):
Also, I fixed the annoying bug that the screen would sometimes stay off during phone calls. This fix is not included in the ROM file above. You need to flash (via recovery, e. g. TWRP) the boot.img inside the *.zip file below to make use of it.
You can find the source of this fix
here on GitHub.
These are the official LineageOS-14.1 sources with only one change to the proximity sensor driver.
Merry Christmas!