Well, I completely reinstalled JMRI 4.17.7 on a Pi 4 with a fresh Raspbian image with the same results, even after disabling ipv6 both in JMRI and in my WiFi config. After startup, I still get 3000ms timeouts for a while, then after approx 3 minutes, I can manually connect. It will randomly show up in Discovered Servers after approx 3 minutes, but will never auto connect.
If I downgrade to JMRI 4.16, I get the same result, except when I manually connect, it does so immediately. i.e., no timeouts.
JMRI 4.17.7 works perfect for me on Linux Mint.
One thing of note, I'm not sure if it's important or not: when I first install Raspbian, mousing over my WiFi on the top right shows my network, ipv4 address and ipv6 address. After an apt-get upgrade, all I get when I mouse over is my SSID. I don't know if it's a software change, or if something is being changed in a recent update which may affect this? Just something I noted. Doing a sudo ifconfig, and all appears normal, so I'm not sure.
I have a few Pi2s laying around. I might try it in those tomorrow.
Scott