I encountered a similar bug in iOS 10 when the iPhone was having trouble activating Wi-Fi right waking up. The issue persisted after clean install iOS and restoring from backup. Obviously the bug persisted in the backup itself, both in iTunes and iCloud. Restoring and setting up the iPhone as new device would definitely eliminated the problem; but it did not fix the bug.
I filed bug report and Apple Engineering team asked me to send diagnostic data of my phone. Subsequently, this particular bug was fixed.
A similar bug was introduced in iOS 12 beta 7 where the iPhone became unresponsive. Shortly after, Apple released iOS 12 beta 8 and the Wi-Fi bug became prominent. The behavior can be reproduced by turning off and turning on the iPhone. After unlocking the iPhone, Wi-Fi would not activate. This bug also present when iPhone lost Wi-Fi connection.
The bug still persists after reseting the iPhone, installing iOS 12 and restoring from the iCloud or iTunes backup. The bug is not present when the iPhone is set up as a new device.
Setting up the iPhone as new device means losing a lot of data that lives only in the iPhone backup.