There is a famous Chassidic story that exemplifies this concept of a short life lived in order to complete a rectification from a previous reincarnation. A couple who had lost their two-year-old son came to the Baal Shem Tov and poured out their hearts to him. The Baal Shem Tov told them that their child had a special soul that had already been in this world. However, it needed to return for a few years in order to achieve a tikkun, a rectification. When the tikkun was complete, the soul could return to its source.

– Otzar Sippurei Chabad, vol. 1, p. 93ff. For an English version, see “The Reincarnated Prince” by Tuvia Bolton:

The anvil upon which

You hammer out souls

from Your royal treasury

let loose a spark

which lit up our darkness

for a brief moment.

Before it was fanned

into a flame

it had already burned out

leaving us again

in the darkness

of uncertainty.

Our only consolation

was the echo of Torah

learned with an angel

and the step closer

it brought us to coming