How do I roll back my iOS version? The 12.2 update has broken my WiFi When I updated my iPhone 8 to 12.2 (16E227), it broke the WiFi and now apps like YouTube can't connect and often times I can't even load apple.com in Safari. When I restart the phone then it works for about a minute. When I turn airplane mode on and off, it works for about a minute.

However my iPad with iOS 9.3.5 works flawlessly. My Samsung laptop works flawlessly. Also when I turn WiFi off on my iPhone and use cell data, it also works.
Basically, you can't.

Apple stop signing previous versions shortly after a new one comes out. iOS 12.1.4 is no longer signed since April 4.

Ref: MacRumors - Apple Stops Signing iOS 12.1.4 Following Release of iOS 12.2

I would look elsewhere for your solution, because had it been a widespread issue it would be well reported by now.