Your argument is correct. Injectivity **is** a set-theoretic property: it says that if two elements $m_1$ and $m_2$ of $M$ satisfy $f\left(m_1\right) = f\left(m_2\right)$ (where $f$ is your map), then $m_1 = m_2$. There is nothing here that would depend on whether $M$ and $M'$ are considered as $B$-modules, as $A$-modules, or as sets. Thus, whether $M$ and $M'$ are considered as $B$-modules, as $A$-modules, or as sets does not matter for injectivity of $f$.
Your doubts suggest that you might be mistaking injectivity for the categorical notion of monomorphism (which would still be independent on whether $M$ and $M'$ are considered as $B$-modules, as $A$-modules, or as sets; but at least this independency would not be totally obvious, because the _definition_ of a monomorphism involves the category).