This is going to sound super weird, but after running your script the adapter detected about 7 more networks in range. I thought "hmm wonder what happens if I try to connect again", entered password, and BOOM Wi-Fi and internet are working again.
My problem is fixed but now I am more confused than ever heh.