DNS Resolution fails inconsistently with IPv6

I recently got a new IPv6 (and WiFi 6) enabled modem, and it seems to be causing some issues exclusively on my NixOS installs (I have confirmed it is only my NixOS devices that are doing this). Programs will choose (seemingly arbitrarily) between using IPv4 or v6. If they choose v6, they will occasionally fail to resolve hostnames, despite having both v4 and v6 DNSs configured in my configuration.nix as such:

networking.nameservers = [
  "8.8.8.8"
  "1.1.1.1"
  "2001:4860:4860::8888"
  "2001:4860:4860::8844"
];

I believe it to be a DNS-related issue, because when I tell Firefox to force using its secure DNS, the problem disappears on Firefox specifically.
Is there anything else that I’m missing that might be causing this behaviour? It’s really frustrating and seriously hurting my productivity (including not being able to run nixos-rebuild).