In your .nmconnection file, In the [ipv4] section, you have the option to choose your DNS, not just your wifi password, for example:
[wifi]
cloned-mac-adress=random
mode=infrastructure
ssid=Your_ssid
[wifi-security]
key-mgnt=wpa-psk
psk=Your_password #or nothing if you don't want to save it
[ipv4]
dns=Your_public_dns;
method=auto
All the configurations you are doing in NetworkManager are in .nmconnection file .
It is in /etc/NetworkManager/system-connections/