This seems to be a problem with some older router models in iOS 11.3 and 11.4 releases. I was able to fix this for my devices, that exhibited the same behavior after updating to iOS 11.4, by doing the following:
1) Factory reset the network configuration in settings. Reason being that I couldn't manage the WiFi connection from the usual menu anymore, so I couldn't make the device forget the WiFi and couldn't trigger another prompt for the password. By resetting all network configurations, I the password prompt would reappear upon conncection and initial configuration would go through properly, with the device able to connect to the internet as usual.
2) However, this fix turned out to be only a temporary one, as the device would again lose WiFi connectivity at some point, after waking the device from sleep for example. I noticed that in that case, the entry for the router / gateway IP would be empty. So the fix for this has been to factory reset the network configuration again as noted above in order to reconnect properly again - and the going into the WiFi settings and hitting the little info button next to the active WiFi connection (symbol: small "i" in a circle) and note the IP config under "IPv4 address". Copy this down somewhere and, on that same screen, tap on "configure IP", switch this from "automatic" to "manual" and fill in the exact same IP config data you noted earlier.
After that, the device has been keeping up the WiFi connectivity for several days now.