If you're using Chrome, that's why. Chrome bypasses your DNS settings and uses Google's DNS because they found using the system settings was affecting their ad revenue. Using Firefox fixes this, although in Firefox you can just use ublock origin anyway, which works even better.
Chrome doesn't behave that way for me. It uses my DNS settings correctly and ads are blocked. I can't remember it ever not behaving, though I usually use Firefox.
The developers of an app that uses ads can also just route the traffic through a server that also provides something crirical for the app to work. You'd have some CDN probably serving both. I mean, in the long run, if app developers work againat it, you can't block apps from showing ads by blocking network traffic.
I doubt that the Android security model lets apps know what's happening on overlays, though, as doing so would create issues for Android as an OS. So apps that cover up ads are hard for app developers to defeat.
So what I never understood, why is this free and is there an risk attaches to using it, e.g. adguard or nextdns logging your traffic or something. I have always been suspicious, for no good reason to be honest, of using such a dns service.