There are several problems with this power-cycling approach:
Pi's don't like to be power cycled. When you turn the switch off, that is a sudden loss of power to the Pi, which can corrupt open files, lose the time on the Pi, etc. Pi's should always be shutdown from software if possible, for a graceful shutdown.
There is already a built-in feature in pihole to disable ad-blocking for a defined time or permanently. This can be done from the web GUI (settings > disable) or from the command line with pihole disable.
Usage: pihole disable [time]
Example: 'pihole disable', or 'pihole disable 5m'
Disable Pi-hole subsystems
Time:
#s Disable Pi-hole functionality for # second(s)
#m Disable Pi-hole functionality for # minute(s)
An example - pihole disable 45s
will disable Pi-Hole for 45 seconds.
This is also incorrect. There is no concept of "first DNS" and "secondary DNS" in a router. If clients are given more than one DNS to use, they will use both and some of the DNS traffic will bypass Pi-Hole. You should route all DNS traffic to Pi-Hole, which will work if you stop power cycling the device.