Why is epimorphism not defined as follows? Epimorphism in category theory, can be seen as a generalization of "surjective function" in Set.
But we could also have characterized surjective functions in Set as follows:

Definition (*). $f:A\to B$ is surjective if for all $Z$, and all $g:Z\to B$, there is a $g_f:Z\to A$ such that $g=f\circ g_f$. 

In Set this definition characterized surjective functions, just as the standard definition for epimorphisms does. But in general categories, this definition is independent from the epimorphism definition (neither implies the other).
Why choose the standard epimorphism definition over (*), or over some other definition that matches in Set, as a generalization of surjective function? What makes the epimorphism definition desirable?
EDIT: Similarly for monomorphism: We can characterize injective functions in Set as:

Definition (&). $f:A\to B$ is injective, if for all $Z$ and all $g:A\to Z$, there is a $g_f:B\to Z$ such that $g=g_f\circ f$.

 A: You definition corresponds to the concept of split epimorphism, which is stronger of that epimorphism.
However, when the category has a projective generator, then epimorphisms can be characterized with a similar concept to being surjective:

In a category with a projective generator $Z$, a morphism $f:X\to Y$ is an epimorphisms if and only if for all $y:Z\to Y$ there exists $x:Z\to X$ such that $y=xf$ (morphisms composition in diagramatic order).

Recall that an object $Z$ is a generator if for each pair of distinct parallel 
morphisms $f,g:X\to Y$ there exists a morphisms $x:Z\to X$ such that $xf\neq xg$.
An object $Z$ is projective if and only if for each epimorphism $e:X\to Y$ and each morphism $y:Z\to Y$ there exists a morphism $x:Z\to X$ such that $y=xe$.
This condition is fullfilled, for example:


*

*in the category of sets by taking $\{\varnothing\}$ as projective generator;

*in the cateogry of modules over a ring taking the ring itself as projective generator;

*in the category of groups taking $\Bbb Z$ as projective generator.


The only if part follows since $Z$ is projective.
For the if part follows arguing by contradiction: if $f$ is not an epimorphism, then there exists a pair of distinct parallel arrows $u,v:Y\to W$ such that $fu=fv$.

Since $Z$ is a generator, there exists $y:Z\to Y$ such that $yu\neq yv$.
Let $x:Z\to X$ such that $xf=y$.
Then
$$yu=xfu=xfv=yv$$
a contradiction.
In that case, epimorphisms are also pullback-stable (see here).
A: Take a look at concrete categories, like groups and topological spaces for instance. In those categories, you can define a notion of surjectivity (resp. injectivity) by using the one from set, because you have a notion of underlying set-map. 
Surely, any generalization of surjectivity (resp. injectivity) you have should be satisfied by those maps as well. 
However, there are (tons, actually) some maps that have surjective (resp. injective) underlying set-maps, but that do not satisfy your condition: there are epimorphisms (monomorphisms) that are not split (your definition is that of a split epimorphism/monomorphism). Therefore, even if your condition is an interesting one, it can't be used to generalize surjectivity (resp.injectivity)
