Reaction of hydrazine and hydroxylamines with carboxylic acids
For simplicity, I will consider the reaction of acetic acid with ammonia, because the same principles apply. The two alternatives are:
$$
\underbrace{\ce{CH3C(O)NH2}}_{\mathrm{amide}} + \ce{H2O} \leftarrow \ce{CH3C(O)OH} + \ce{NH3}\rightarrow \underbrace{\ce{CH3C(NH)OH}}_{\mathrm{imidic \ acid}} + \ce{H2O}
$$
where the group connected via a double bond has been set in parentheses. The two products are connected by protonation/deprotonation in a tautomeric equilibrium, so the question boils down to thermodynamic stability. For most cases, we expect the C-O double bond/C-N single bond combination to be more stable than the C-N double bond/C-O single bond combination.