On Android you have to disable the use of Private DNS (or something like that) in the WiFi settings. If this is enabled it will not use your WiFi's broadcast DNS, but a predefined one. The reasoning behind this (you can believe this or not) is so that on public WiFis your DNS queries cannot be tracked or manipulated by setting up a local DNS.
I can imagine there is something similar for iOS.
If this only affects some apps then they have decided to hardcore their DNS servers. The only thing you can do now is to identify these and block the calls, but this may also break other stuff if the servers are not only used to resolve ad URLs.