Qubit-mediated deterministic nonlinear gates for quantum oscillators