A conserved and regulated mechanism drives endosomal Rab transition