WiFi dies if phone tries to connect to it The basic situation is this:


Phone tries to connect to my parents' WiFi, fails


The WiFi then drops shortly, no other devices can connect to it
A laptop connected via ethernet to the router can still access the internet

Only way to resolve WiFi issue is to restart the router.
Connecting to another WiFi (i.e. my dad's phone's hotspot) also fails, no connection can be made


I have tried the following things:

On my phone:


Factory reset (running the latest pre-Oreo OxygenOS, OnePlus 5)
Restore an old backup from a month ago, full NANDROID via TWRP.
Wipe everything, again.
The above, with various combinations of...


Locked or unlocked bootloader
Stock recovery or TWRP

Flashing the latest LineageOS nightly.


None of the above attempts changed anything. Even during the initial setup process, trying to connect to the WiFi fails (and kills the WiFi for everyone else)

On the router


Factory reset
Changing from DHCP to static IP (some forum posts suggest duplicate IP in this scenario)
Changing the address range of DHCP from .100 - .199 to .10 - .99 to ensure all devices get new IPs


Conclusion

I have googled all the things. I have tried everything I can think of. I have no idea what else to try.
On top of this, the mobile network at my parents' place is so bad my phone basically has no internet connectivity.
This has been going on for 3 days now.
I am sad.
Sigh...

I wiped everything and installed the OxygenOS Oreo beta through adb sideload and now it works.

Hell do I know why this works now, but not even a complete OS switch to LineageOS worked.