In that case Foxconn isn't an example of an average company paying average wage. The disposable income per capita in China was 36396 chinese yuan in 2017, which makes a little over 400 USD per month. Median disposable income is even lower. You're not even close to buying iPhones with that kind of wages.
At $400USD/month after food, housing, transportation, and healthcare are taken care of absolutely puts you into iPhone purchasing range.
Now, albeit, they're slightly on the higher end of Chinese workers, but it's not just the shitty aristocrat's kids spending money on iPhones. The people making the things make enough money to buy one, just the same as my hairdresser does.