I have a similar problem that the IMAP server can’t be found only when I’m at home on wifi. Happens only on iOS devices and only on wifi. If I turn wifi off the issue goes away immediately.
While on wifi it works 70% of the time - then fails.
Been connected to the same wifi network for YEARS...