Matrix Multiplication $\to$ Function Composition?

Instead of the function $f : \mathbb{K} \to \mathbb{K}$, with $$f(x) = \frac{ax+b}{cx+d},$$ think about the function $g:\mathbb{PK} \to \mathbb{PK}$ with $$g([X:Y]) = [aX + bY : cX + dY].$$The $[A:B]$ notation is of projective space, which is $\mathbb{K}^2/\sim$, where $[a : b] \sim [A:B]$ if $ aB = bA$.

One can go from one to the other by the natural substitution $x = X/Y$. Indeed, one can think of projective space as a 2-dimensional vector space and as such $g$ is a linear map, (projective linear, but linear nonetheless). So it can be represented by a matrix for $\mathbb{PK}$ to itself (or more fancy: $Aut(\mathbb{PK}) \cong PGL(2, \mathbb{K})$. Which look just like two by two matrices over $\mathbb{K}$ modulo scalar matrices. And this works well for what you want them to do, since if you check then $\frac{ax+0}{0x+a}$ (a function relating to a scalar matrix and the projective function [aX + 0Y: 0X + aY] = [X:Y]) is indeed the identity function.

Although the above is astonishing and does help answer part of your question, it does not answer it entirely. You placed no restriction on $a$, $b$, $c$ or $d$, whereas I did. I assumed $ad-bc \neq 0$. I'm going to show you why this is a valid, and important assumption.

If $ad = bc$, then the fractional map reduces to $\frac ac$ and is constant. Now, if you compose several matrices and one of them is a singular matrix, then the resulting matrix is. Similarly, composing several functions and if one of them is constant, then the resulting function is also.

But $d=2$ was fairly arbitrary here, the same is true for any dimension. However, when $d=2$, we can think of the projective space as fractions, and so can relate the fractional linear maps with the matricies. Note that more generally $Aut(\mathbb{P^nK}) \cong PGL(n+1, \mathbb{K})$. Which has a fairly elementary but lengthy proof in Hartshorne comment 2.7.1.1, which I won't recreate.

You can construct functions which have a similar property to the one you wanted, but instead, it would be a function from $\mathbb{K}^{n-1}$ to itself for $n$ by $n$ matrices. If you wanted to make it work for 1 variable, the only way would be to take a copy of $\mathbb{PK}$ inside a much larger space, and do everything else the same, but this is a rather trivial and disappointing answer.