Most of the more advanced gateways have some sort of DNS filtering built in. Opnsense has an adguard plugin, pfsense has pfblocker-ng, openwrt has a few different options, Unifi and mikrotik both have solutions too I think. Usually you can just load the same block list that pihole uses into the filtering software and you are good to go.
If you want the most flexibility and want to use the same hardware for both gateway/DNS and want to try out different DNS/router solutions a hypervisor would give you the most options. But it would also be the most complicated.
Both opnsense and pfsense allow custom DNS entries so you still have that as an option. Probably the other options do too but you’ll just have to verify.
But if you want to keep it simple I would just keep the pihole as a separate device. A lot of the built in options aernt quite as easy to setup and don’t have the best UI compared to pihole IMO.