This is indeed a common use case when one has more than one network cnnection, e.g. an internet connection (for the generic traffic) and a vpn connection (just for traffic to a company or remote site).
This is a valid example for the question of the OP.
I know no operating system (excluding OSX as I've learned above) which can handle this problem from stock. Having linux, one solution may be using dnsmasq with resolvconf.
Resolvconf keeps track on all the different domains and namserver and generates a cfg for dnsmasq. Dnsmasq includes this cfg. The local system then uses dnsmasq as nameserver.
In a more static scenario, one could spare resolvconf and use dnsmasq, only.
And yepp, this is a necro thread, but hence there is no advance in the last 3 years, I resurrect it to get the focus back on this quite old, but still unsolved problem.