Let $A$ be a commutative ring with identity. I would like to prove the following well-known result using a certain approach:
Any surjective endomorphism of a finitely generated $A$-module $M$ is an isomorphism.
It suffices to prove it for local rings. For any surjection $\phi: M\to M$ the is an exact sequence $0\to \mathrm{Ker}(\phi)\to M\to M\to 0$. $\textbf{If we assume that}$ $M$ is flat over $A$, then $M\simeq A^n$ for some $n$ since $A$ is a local ring. We can tensor the exact sequence by the residue field $k=A/\mathfrak m$ to obtain another exact sequence $0\to \mathrm{Ker}(\phi)\otimes_A k\to k^n\to k^n\to 0$ and obtain that $\mathrm{Ker}(\phi)=0$. Since $M\simeq A^n$, $\mathrm{Ker}(\phi)$ is finitely generated as an $A$-module and thus by applying Nakayama's lemma one has $\mathrm{Ker}(\phi)=0$, as desired.
This works nicely by transforming the problem for a flat module over a local ring to a finite-dimensional vector space over the residue field $A/\mathfrak m$. One thing that bothers me is that this method does not naturally apply for an arbitary finitely generated module over a local ring $A$. First the kernel of the map $\phi: M\to M$ might not be finitely generated, and tensoring by the residue field only gives me the right exactness.
I would like to know if there is some technique or formalism to reduce the theorem for finitely generated modules over a local ring to finitely generated flat modules over the same ring. I should be most likely looking for a homological technique.
This question might be a little vague. Any help/reference would be appreciated.