Quantum subroutine problem and the robustness of quantum complexity classes