Runaway electron populations seeded from the hot tail generated by the rapid cooling in plasma-terminating disruptions are a serious concern for next-step tokamak devices such as ITER. Here, we present a comprehensive treatment of the thermal quench, including the superthermal electron dynamics, heat and particle transport, atomic physics, and radial losses due to magnetic perturbations: processes that are strongly linked and essential for the evaluation of the runaway seed in disruptions mitigated by material injection. We identify limits on the injected impurity density and magnetic perturbation level for which the runaway seed current is acceptable without excessive thermal energy being lost to the wall via particle impact. The consistent modeling of generation and losses shows that runaway beams tend to form near the edge of the plasma, where they could be deconfined via external perturbations.