Polynomial maps over finite fields and residual finiteness of mapping tori of group endomorphisms