Wifi greyed out and only get it back when turning off the phone and plugging a charger
So, I noticed that my wifi cuts off and is unable to find any networks after I unplug a charger or earbuds. The only way to get it to work again is to turn off my phone, then plug in the charger and wait for it to reboot. This works until I unplug the charger. This trick does not work with earbuds.
Steps I have tried, all of these I have tried several times
Reboot my router.
Check that wifi itself is working on other devices and it is.
Reset network settings on the iPhone.
Factory reset the iPhone.
Download and install the most recent ios update (14.4.1).
Device is iPhone 8 plus.
Ps. Worth noting that I have not experienced any other issues related to the charger port such as not detecting earbuds or the charger, never.