Concerning the temperature, keep in mind that battery operation temperature ideally should remain below 40 Celsius, and I believe that the phone will shutdown when battery temperature gets close to 50 Celsius to avoid fire hazards. It means that the “overheating” range is only 10 degrees Celsius, so knocking off 5 Celsius gets you half the way out of trouble! Besides, long-term battery life and rate of discharge are negatively affected by overheating. So again, 5 Celsius can pay you handsomely in terms of protecting your battery and hardware.
The question is: if this is so beneficial, why is it that engineers don’t introduce more strict battery temperature control in their smartphone designs? The reason is simple and quite twisted: because users would think those correctly designed smartphones are inferior products, after all they slow down when battery is under stress. The marketing decision therefore is to allow battery and hardware abuse to give users the impression that their gear performs better than their competitors’.
We’re all the way back to the OP question: why smartphones produce so much heat? Well, they overheat by design, it’s another case of race to the bottom, enabled by consumers’ lack of discernment.