Pi-hole working for devices, but RPi can't connect to internet

Pi-hole is handling DNS only.
All other network traffic apart from DNS will still travel from and to your clients through your default gateway.

ping is using the ICMP protocol and thus is ill suited for analysing DNS issues.
Use nslookup or dig instead.

No, ping is telling you that 192.168.0.21 is unable to send any data to its destination 192.168.0.1 since that IP is unreachable, i.e. no ping has ever left your Pi-hole machine.

We've seen a similar report for such intermittent failures with a Netgear C6300 before, but no conclusive explanation could be found then.

However, what ping reports is not necessarily related to your DNS issues.

Do I read you correctly:
Your clients resolve DNS via Pi-hole ok, but accessing the internet from your RPi running Pi-hole fails, apart from Youtube and Google?

Let's see what your Pi-hole RPi is using for DNS:
Run from your RPi, what's the output of the following command:

dig pi.hole