Dynamical approach to ancilla-assisted quantum thermometry