From quantum critical to two-channel Kondo physics via charge fluctuations in a quantum dot