The standard definition of function composition is:
Let $f : A \to B$, $g : B \to C$ then there is a composite function $g \circ f : A \to C$, given by $(g \circ f)(a) = g(f(a))$ with $a \in A$
Why could not be given a less restrictive definition like the following?
If $f : A \to B$, $g : D \to C$, $\operatorname{rg}(f) \subseteq D$ then there is a composite function $g \circ f : A \to C$, given by $(g \circ f)(a) = g(f(a))$ with $ a \in A$