Your reply saved my phone!
Hope my experience + your solution can help others...
Had some water spill onto the phone while charging which was discovered too late. Phone would no longer turn on, and the USB port looked damaged. Removed the screen and discovered that water traveled into the bottom of the phone so I removed major components from the bottom up until I could be sure all was dry and then let sit 48 hrs to be sure.
Phone finally powered back on, but went to recovery mode and requested I plug into itunes. itunes could not resinstall iOS and kept giving me 4013 error.
At the store, Apple said my phone was gone and to buy a new one - "nothing they could so." A local repair shop said $150, and they could replace the motherboard, but couldn't guarantee anything. FYI, replacing just the motherboard also means FaceID stops working as the camera and board are tied together.
However, since the source of the initial issues was the charging port, I bought a new USB flex and lo and behold, Itunes was able to reinstall the iOS! After patting myself on the back for the $8 repair, I reassembled the phone but discovered it powering off every 3 minutes to the dot. Spent hours trying to diagnose, and ran into many posts about the 3 minute restatrt, but no solutions. Much was attributed to a bad motherboard. Finally stumbled upon this lone reply which suggested my "new" USB flex was actually bad, which was further supported by iOS diagnostics error log showing me that every 180 seconds it was shutting down because it was getting a thermalmonitor error.
Long story short, another new $12 USB flex later from Amazon, and my iphone X is now completely operational.