I have included a short part from a synthetic pathway from: https://synarchive.com/syn/112
$\ce{Mg3N2}$ reacts with $\ce{MeOH}$ to liberate $\ce{NH3}$ which I believe is used in nucleophilic substitution at the esters and amides in the last step. However, before this, the designers of this reaction pathway added in TFAA, introducing new groups onto the amines. Why is this step necessary? Why can't the researchers just use $\ce{NH3}$ or $\ce{Mg3N2}$ right after $\ce{SOCl2}$ and $\mathrm{h\nu}$?