To make my comment an explicit answer:
Given $C, D$, there are $A_i, B_i$ with $C = A_0B_0$, $D_i = B_iA_i$, $D = D_n$ if and only if the Jordan normal form of both are the same, up to deleting the block corresponding to the generalized 0-eigenspace. As such, any "cyclic" function depends only on that "reduced" JNF. If you further require continuity, then you restrict yourself to functions which are generated by the coefficients of the characteristic polynomial.
Proof: for one direction, proving it for $C = AB, D = BA$ is enough. Let $v$ be a generalized eigenvector of $C$ with nonzero eigenvalue $\lambda$ of "type" $i$ (I'm not sure of the proper word here; "type" 0 refers to actual eigenvectors, while $(C - \lambda I) v$ is of type $i - 1$ if $v$ is of type $i$). Then $Bv$ is nonzero, so by induction, we can see that it is also a generalized eigenvector of eigenvalue $\lambda$ of type $i$. We therefore have a bijection between general eigenvectors of $C$ and $D$ with nonzero eigenvalues $\lambda$ of type $i$; this means directly that the "reduced" JNF must be the same. Note that this also limits how "quickly" you can get from one to the other (i.e. a minimal n): you can only change the length of any one block by 1 for each "cycle".
The reverse is obvious when dealing only with the Jordan normal forms, and the rest can be gotten by conjugating the relevant matrices. To explain further: David Speyer has shown how to make the relevant generalized 0-eigenspace blocks equivalent; simply adding on the other blocks gives the normal form equivalences. Then if we have that $C' = XCX^{-1}, D' = YDY^{-1}$ are the JNF of $C, D$ and $C' = AB, D' = BA$, then $C = (X^{-1}AY)(Y^{-1}BX), D = (Y^{-1}BX)(X^{-1}AY)$ gives a cycling for C and D.
Therefore, any cyclic function depends entirely on the "reduced" JNF, and any function that does depend on that is cyclic.
As a note, this proof works just as well for rational normal form, so you can even restrict the $A_i, B_i$ to the same field as $C, D$.