Let $f: A \rightarrow B$ a ring morphism of commutative rings, then one has on $B$ a multiplication by elements of $A$ defined by $b*a \doteq b.f(a)$ (where . is the multiplication in the ring $B$).
If $f$ is injective (or, equivalently, $A$ is a subring of $B$ and $f$ the inclusion map), we say that an element $b \in B$ is integral over $A$ (by the function $f$) (https://en.wikipedia.org/wiki/Integral_element) iff it is a root of a monic polynomial with coefficients in $A$.
My question is: what's wrong is extending the definition also to non-injective morphisms?
Nothing is wrong with it, and indeed this is an accepted definition. For any $A$-algebra $B$ it makes sense to talk about the set of elements in $B$ integral over $A$. See http://stacks.math.columbia.edu/tag/00GI.