This is not true. A simple counterexample: $$A = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}$$ $$B = \begin{pmatrix} 0 & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}$$ This result is true for $2 \times 2$ matrices, as we will see below. Here is how I would think about this: Let $F(x,y)$ be the polynomial $\det(\mathrm{Id}+xA+yB)$. The condition that $A$ and $B$ are nilpotent says that $F(0,y)=1$ and $F(x,0)=1$. The condition that the eigenvalues of $A e^{i q} + B e^{-i q}$ are constant says that $F(t e^{iq}, t e^{-iq})$ is constant, in other words, that $F(x,y)$ is a polynomial in $xy$. So you would have a proof if, whenever $F(x,0)=F(0,y)=1$, then $F$ is a polynomial in $xy$. This is true for $\deg F \leq 2$, which proves your result for $2 \times 2$ matrices. But for higher degree $F$ this is very false. For example, look at $F=1+p x^2y+q xy^2+r xy$ for any $(p,q) \neq (0,0)$. I believe, but cannot immediately cite a reference, that any degree $n$ homogenous polynomial $F(x,y,z)$ can be expressed in the form $\det(xA+yB+zC)$. In any case, I know references which state this for $F$ smooth, and there are plenty of smooth polynomials of the form we need. Moreover, if $F(0,0,1)=1$, then we can replace $(A,B,C)$ by $(A C^{-1}, B C^{-1}, \mathrm{Id})$ in order to take $C=\mathrm{Id}$. So, even if I hadn't found the particular example above, I would already be sure I could find matrices $A$ and $B$ which violated your claim.