Nonadiabatic dynamics across a first-order quantum phase transition: Quantized bubble nucleation