How to debug iPhone slow/hung wifi network problem PROBLEM

I have a very strange problem: my iPhone network seems to hang every few minutes. It happens in Safari, Mail, News, Twitter, Tweetbot, YouTube, and other apps. Here are some ways it happens:


when I Google search from the Safari omnibar (page load progress bar gets stuck at 15%, network activity spinner keeps spinning, followed often by a "Safari could not open the page because the server stopped responding"; oddly, Google autocomplete suggestions work perfectly while I'm typing the search query)
when I click a link in the search results (the page load progress bar gets stuck at about 30%)
when I try to refresh Mail with pull-down and release (the "Checking for new mail" message shows for a long time, even though my mail server is on the same LAN)
when I click on a story in News (blank page often followed by "you're not connected to the Internet")
when I click on a link in Twitter or Tweetbot


In all instances, I just have to wait a minute and everything is back to normal, until it happens again in 5-10 minutes, which is super annoying.

I have multiple wired and wireless devices connected to the network (and AirPort Extreme 802.11ac wifi access point) and this only happens on my iPhone. I don't think I'm losing wifi during these hangs, I suspect it's some kind of TCP/IP (DNS, IPv6, etc.) issue. I have an uncommon network setup:

Internet > cable modem > pfSense firewall > Windows Server (Mail and DNS server) > LAN switch > Airport Extreme

QUESTION

What is causing this?

What do I look for when debugging this using the Device Console, Xcode Instruments, or WireShark?
In case any one with this problem stumbles across this question, the problem fixed itself after upgrading to iOS 12, so my guess is it was a bug in iOS 11.