MacBook - WiFi won't connect in macOS but rebooting into Windows does?
I figured it out. It's the weirdest thing.

My WiFi doesn't work when I have a certain external HDD plugged in via USB (Seagate Backup Plus).

I have no idea why it would be interfering with the WiFi signal. I don't have this problem with other external HDDs.

Edit

Upon further investigation it appears to be an issue specifically with the USB C to A adapter that I am using. This question is my exact issue.

The WiFi interference is strongest when I plug in my Seagate Backup Plus 4TB external HDD, a little less when I plug in my Seagate Expansion 1TB, and little or no interference when I plug in my mouse.

It probably has to do with the amount of power these devices require, and also my USB adapter is very cheap so it probably has bad shielding.

I also have an official Apple USB adapter that does not have this problem, but I don't know if it's because this adapter has a cable so it is slightly separated from my laptop, or maybe it's just better quality with proper shielding.