If I'm working in the realm of finite sets on the form $\underline{n} = \{1, \ldots, n\}, n \in \mathbb{N} $.
Consider any two transformations $f :\underline{n} \to \underline{m}$ and $g :\underline{m} \to \underline{k}$ such that $k \geq m > n$. Is the composition $g \circ f $ well defined?
I'm thinking no, since $f$ is a $n$-tuple and $g$ is a $m$-tuple. For example take $n = 3, m = 4$ with $f = (2,3,4), g = (1,2,3,4) = 1_{\underline{m}}$. Can I really put these two functions together?
Why shouldn't $g \circ f$ be defined? $f$ and $g$ are two well-defined functions and we have ${\rm dom}(g) = {\rm codom}(f) = \underline m$. This are all conditions that have to be fulfilled. We have - as always for compositions - $(g\circ f)(j) = g\bigl(f(j)\bigr)$ for $j \in \{1, \ldots, n\}$.
If we identify these functions with tuples, it may seem not usual to have compositions, but it changes nothing. Definedness of compositions is not changed by a change of notation. In your example we have - as $g$ is the identity - $$ (g \circ f) = f = (2,3,4). $$