Uncited rumour is iPhones for the last ~3 years have had special flashlight LED's (made by NXP?) which also embed an RGB colour sensor for exactly this reason. The LED's when reverse biased send out the results of the RGB sensor. It has been suggested the reason they didn't use an extra pin was to hide this anti-flicker feature from competitors who were sure to do a detailed teardown of the phone.
There are x-rays of the LED here: https://www.chipworks.com/about-chipworks/overview/blog/true...