$\DeclareMathOperator\perm{perm}$Let $A$ be an $n \times n$ matrix with arbitrary complex entries and $1 \le i \le n$ an index and let $A^i$ the the matrix $A$ with the $ith$ row and column deleted. Define the rational functions
$$f_{A,i}(x):=\frac{\det(xI_n-A)}{\det(xI_{n-1}-A^i)}, \;\; g_{A,i}(x)=\frac{\perm(xI_n-A)}{\perm(xI_{n-1}-A^i)}.$$
It seems remarkable that rational functions of the form $f_{A,i}$ and also $g_{A,i}$ are closed under composition. Moreover there is an explicit compositional law. If $A$ is an $n \times n$ and $B$ is $m \times m$ and given indices $i,j$, there is a well defined $nm \times nm$ composed matrix $A(B_j)$ and a composed index $k=(i-1)m+j$ such that
$$\tag{+}\label{488519_+}f_{A,i}(f_{B,j}(x))=f_{A(B_j),k}(x),\;\;\; g_{A,i}(g_{B,j}(x))=g_{A(B_j),k}(x).$$
The compositional laws \eqref{488519_+} also preserves sub-structures. If $A$, $B$ are adjacency matrices of graphs or trees, then so are the composed $A(B_j)$. Recently it has been found that \eqref{488519_+} in the case of graph are useful for constructing sequences of trees and graphs with prescribed eigenvalues, see ($*$) of Tree with $1+\sqrt{2}$ an eigenvalue of its adjacency matrix.
In \eqref{488519_+} we need to define the composed matrix $A(B_j)$. The definition of $A(B_j)$ does not depend on $i$ but one need to specify $i$ to define $k$ in the RHS of \eqref{488519_+}. In the case of graphs, $A(B_j)$ means attaching a copy of $B$ at its vertex $j$ to all vertices of $A$.
The $nm \times nm$ matrix $A(B_j)$ consists of an $n \times n$ block of $m \times m$ matrix $B(s,t)$, $1 \le s,t \le n$ where we first set all diagonal $B(s,s)=B$ and all off-diagonal block $0$. We then add the entries $A_{st}$ of A to all the $(jj)$ entry of $B(s,t)$.
It seems useful to give a specific example where one can also verify \eqref{488519_+}. Let
$$A= \begin{pmatrix} 2 & 1-i \cr 1+i & 3 \end{pmatrix}, B=\begin{pmatrix} 1 &-i \cr 2i & 2 \end{pmatrix},$$
we then have writing $\phi_A(x)=\det(xI-A), \psi_A(x)=\perm(xI-A)$ for the characteristic polynomials,
$$A(B_1)=\begin{pmatrix} 3 & -i & 1-i & 0 \cr 2i & 2 & 0 & 0 \cr 1+i & 0 & 4 & -i \cr 0 & 0 & 2i & 2\end{pmatrix}, A(B_2)=\begin{pmatrix} 1 & -i & 0 & 0 \cr 2i & 4 & 0 & 1-i \cr 0 & 0 & 1 & -i \cr 0 & 1+i & 2i & 5\end{pmatrix}$$
$$f_{A,1}(x)=\frac{x^2-5x+4}{x-3}, f_{A,2}(x)=\frac{x^2-5x+4}{x-2},g_{A,1}(x)=\frac{x^2-5x+8}{x-3}, g_{A,2}(x)=\frac{x^2-5x+8}{x-2}$$
$$f_{B,1}(x)=\frac{x^2-3x}{x-2}, f_{B,2}(x)=\frac{x^2-3x}{x-1},g_{B,1}(x)=\frac{x^2-3x+4}{x-2}, g_{B,2}(x)=\frac{x^2-3x+4}{x-1}$$
$$\phi_{A(B_1)}(x)=(x^2-7x+8)(x^2-4x+2)$$
$$\phi_{A(B_2)}(x)=(x^2-7x+4)(x^2-4x+1)$$
$$\psi_{A(B_1)}(x)=x^4-11x^3+50x^2-106x+88$$
$$\psi_{A(B_2)}(x)=x^4-11x^3+45x^2-75x+44$$
and so that we can verify indeed
$$f_{A,1}(f_{B,1}(x))=\frac{(x^2-7x+8)(x^2-4x+2)}{(x^2-6x+6)(x-2)}=\frac{\phi_{A(B_1)}(x)}{\phi_{A(B_1)^1}(x)}=f_{A(B_1),1}(x)$$
$$g_{A,2}(g_{B,1}(x))=\frac{x^4-11x^3+50x^2-106x+88}{(x^2-5x+8)(x-2)}=\frac{\psi_{A(B_1)}(x)}{\psi_{A(B_1)^3}(x)}=g_{A(B_1),3}(x).$$
The questions are
Has the composition operation $A(B_j)$ appeared before ? We generalize it from the case of adjacency matrix and there is essentially only one or two possible ways to try. Note if $A$, $B$ are Hermitian or skew symmetric etc then so is $A(B_j)$
How does one prove \eqref{488519_+}? We sort of have a proof generalising the case of graphs which is messy. We can also view \eqref{488519_+} as a huge matrix-determinant/permanent identity. So is it just linear algebra ?
There is also a multi-composition version. Let $A$ be $n \times n$ and let $B_{t,j_t}, t=1,...,n$ be $m_t \times m_t$ matrices with indices $1 \le j_t \le m_t$. Then the multi-composed $\sum m_t \times \sum m_t$ matrix $A(B_{1,j_1},...,B_{n,j_n})$ is an $n \times n$ block matrix where for $1 \le s,t \le n$, $B(s,t)$ is an $m_s \times m_t$ matrix. We first let for $1 \le s \le n,$ the diagonal block $B(s,s)=B_s$ and all off diagonal block zero and then we have to add the $A_{st}$ entries of $A$ to the $(j_s,j_t)$ entries of the $(s,t)$ block $B(s,t).$
If $A, B_j$ are adjacency matrices of graph, $A(B_{1,j_1},...,B_{n,j_n})$ will be the adjacency matrix of the graph formed by attaching the graph $B_t$ at its vertex $v_{j_t}$ to $A$. There is a multi-variable compositional law. For a $n \times n$ matrix $A$ and and index $i$, set $I^n_x=diag\{x_1,...,x_n\}$ and define
$$F_{A,i}(x_1,...,x_n)=\frac{\det(I^n_x-A)}{\det(I^{n-1}_x-A^i)}.$$
The multi-compositional law is then
$$ f_{A(B_{1,j_1},...,B_{n,j_n}),k}(x)=F_{A,i}(f_{B_1,j_1}(x),...,f_{B_n,j_n}(x)) \;\; (++)$$
where $k=m_1+..m_{i-1}+j_i$, and a multi-variable, multi-composed law
$$ F_{A(B_{1,j_1},...,B_{n,j_n}),k}(x_1,...,x_n)=F_{A,i}(F_{B_1,j_1}(x_1),...,F_{B_n,j_n}(x_n))\;\;(+++)$$
where each $x_t=(x_{t,1},...,x_{t, m_t}), 1 \le t \le n.$
There is a similar dual compositional laws with determinant replaced by permanent.
(Added) The proof of (+) in the case of tree is very simple and is given in https://mathoverflow.net/q/488524 . More details are given in the following post