Let $S$ be a semiring (i.e. satisfies all the ring axioms besides existence of additive inverses) and $M, N$ semimodules over $S$ (same thing). For a linear map $\varphi : M \rightarrow N$, we can still say that $\ker \varphi = \lbrace v \in M \mid \varphi(v) = 0 \rbrace$ is a subspace of $M$, but we cannot form quotients in general. Is there still some connection between kernels and injectivity?
For example, if $\psi : M \rightarrow M$ is surjective, linear, and $\ker \psi = 0$, is $\psi$ also injective? For $M$ free of finite rank, this is follows even without $\ker \psi = 0$, but what about the case that $M$ is not free?
$S$ is irrelevant here, this is purely a question about commutative monoids. It is not true that if the kernel vanishes then a map between commutative monoids is injective; as a simple example, take the commutative monoids $\{ 0, 1, 2 \}$ and $\{ 0, 1 \}$ under $\text{min}$, with $\varphi$ given by $\varphi(0) = 0, \varphi(1, 2) = 1$. The lack of subtraction prevents us from using the usual proof.
The correct replacement for the kernel in these situations is the kernel pair
$$\text{ker}(\varphi) = \{ (m, m') \in M: \varphi(m) = \varphi(m') \}$$
which more or less by definition has the property that it is trivial (meaning that both of the natural projections to $M$ are isomorphisms) iff $\varphi$ is injective, and can abstractly be defined as the pullback of $\varphi$ along itself. Moreover the kernel pair defines an equivalence relation on $M$ (also known in this setting as a congruence), and it is meaningful to quotient $M$ by this equivalence relation as a categorical operation in the category of commutative monoids, and the result is $\text{im}(\varphi)$ so we can even rescue the first isomorphism theorem.
The kernel pair has these properties in great generality, in particular in $\text{Set}$ and in every category of algebraic structures in $\text{Set}$. For more discussion you can see my old blog posts Internal equivalence relations and Regular and effective monomorphisms and epimorphisms.