iOS is likely indexing (even after a restore or transfer) things like content, Photos (faces, etc).
This will continue for some time and it should get better, but, also, modern phones are thin, have bigger and bigger batteries in them, and have and less and less free space/ventilation, so even with process improvements on the SoC and thermal improvements, they're going to get hot-ish. Basically, manufacturers will push the thermal limit until "ouch, I can't hold it", because if they did not, they are leaving battery life, performance, or form factor improvements on the table.