That doesn't work the same as pihole. PiHole blocks ads on ALL devices on your network. Your computer, your laptop, your phone, your kids kindle, etc. As long as they are on your network, they are protected (and browsing web pages on an older phone, things are much faster)
Yeah this is something I've been thinking about lately as well. Pi-Hole seems cool but what about most of the time when I'm somewhere else than my local network?
I use AdBlock https://www.adblockios.com on iOS which runs a local DNS server that can blackhole domains. It doesn't work well on very large host files so I gave up trying to import https://github.com/StevenBlack/hosts, but it does work well for smaller lists.
(1) Install "1Blocker X" -- not free but it's cheap.
(2) It has a huge number of rules and protects your Safari pretty damn good.
(3) You can disable the existing rules if you so choose.
(4) You can add new ones based on URL regexes or CSS rules.
I am still using it actively both on my iPhone and iPad, one of the best investment in apps I ever did.