It is a laugh that a computer engineer does not understand how bugs occur to even ask that question. Bugs occur when there are conflicts between two or more resources competing for the same resource, and create a collision, causing the crash or failure of completing the requested resource in accessing the wifi. I have even documented the system crash log in this thread earlier on how the wifi connections are repeatedly crashed by other resources, causing wifi to fail, thus resorting to use cellular data to complete the data requests.
Why did it not happen to your device? As simple as the fact that your iPhone does not use the same apps as others that caused the crash and/or conflicts. It has been reported numerous times in this thread that microsoft mail exchange network caused the wifi to fail repeatedly every 3 sec. Too bad you don't use MS mail exchange to cause your iPhone to fail.
Why did restoring and reset the iPhone from backup resolved the problem? Because it resolved the conflicts when everything is re-initialized, resolving the conflict. Why did the wifi problem resurfaced after awhile? Because poorly written system resources starts to accummulate up to a point that resource conflicts re-occur again.
Have you ever programmed multi-threaded programs before? I feel sorry for you if you have not. One of the classic conflicts, which is extremely difficult to debug, in concurrent programming is deadlock. Have you ever heard of "deadlock" before? Do you know what deadlock is? Do you know how deadlock occurs? Do you know why deadlock is unpredictable and extremely difficult to reproduce? Do you know just because your app did not create a deadlock does not mean other apps would not create deadlock?
If you want to know, deadlock is created when 2 processes request the same system resource at the same time, but both are blocked from the resource unless the other releases it. It creates a contention, no one is giving in, both are fighting for the same thing, so no one wins, no one get any resource, and this goes on to infinity. It is caused by the timing of the request, it only happens when the resources are requested by 2 or more processes at the same time. If they were requested at different time, it is a non-issue. But when will they be requested at the same time is entirely unpredictable, even with the same apps running. It is one of the biggest problems and biggest bug that is extremely difficult to catch and track down. The only way to resolve a deadlock is when the system times out, realizing that it takes forever to get the resource, the system simply kills the processes and restart from scratch. But in the meantime, while the processes are in deadlock, the wifi is inaccessible. This defaults the system into using cellular data, even when wifi is connected.
If you don't understand this, go back and read the textbook on this classic bug that is next to impossible to debug or track down if the program was poorly written that leads to this unpredictable behavior.