Late activity of the central engine is often invoked in order to explain the flares observed in the early X-ray afterglow of gamma-ray bursts, either in the form of an active neutron star remnant or (fall-back) accretion onto a black hole. However, these scenarios are not always plausible, in particular when flares are delayed to very late times after the burst. Recently, a new scenario was proposed that suggests X-ray flares can be the result of the passing of a long-lived reverse shock through a stratified ejecta, with the advantage that it does not require late-time engine activity. In this work, we numerically demonstrate this scenario to be physically plausible, by performing onedimensional simulations of ejecta dynamics and emission using our novel moving-mesh relativistic hydrodynamics code. Improved efficiency and precision over previous work enables the exploration of a broader range of setups. We can introduce a more physically realistic description of the circumburst medium mass density. We can also locally trace the cooling of electrons when computing the broadband emission from these setups. We show that the synchrotron cooling timescale can dominate the flare decay time if the stratification in the ejecta is constrained to a localised angular region inside the jet, with size corresponding to the relativistic causal connection angle, and that it corresponds to values reported in observations. We demonstrate that this scenario can produce a large range of observed flare times, suggesting a connection between flares and initial ejection dynamics rather than with late-time remnant activity.