After pondering for an interesting answer to a recently asked question, I discovered the following phenomenon. Suppose $A$ is a $3\times3$ matrix whose elements are taken from some field. If $A$ is not upper triangular but $B:=A^2$ is upper triangular, then $B$ has a repeated eigenvalue.
Here is a proof outline. Let $A=\pmatrix{a&b&c\\ p&q&r\\ x&y&z}$. Since $A$ is not upper triangular, $(p,x,y)\ne(0,0,0)$. The condition that $A^2$ is upper triangular is equivalent to the set of conditions \begin{align} ap+pq+rx&=0,\tag{1}\\ ax+py+xz&=0,\tag{2}\\ bx+qy+yz&=0.\tag{3} \end{align} Suppose both $p$ and $x$ are nonzero. Then $(1)$ and $(3)$ give \begin{equation} \frac{(ap+pq+rx)(a+z)}{p} + \frac{(bx+qy+yz)p}{x} = 0.\tag{4} \end{equation} Substitute $(2)$ into $(4)$, we obtain $a^2+bp=yr+z^2$. Hence $B_{11}=B_{33}$ in this case. The other cases where $(p,x,y)$ is $(=0,=0,\ne0),(=0,\ne0,\ne0),\ldots$ etc. can be handled by similar or simpler algebraic manipulations of $(1)-(3)$, and other equalities between the diagonal elements of $B$ (i.e. $B_{11}=B_{22}$ or $B_{22}=B_{33}$) may occur in these cases.
However, this proof feels ugly because it uses coordinates too heavily and it has to consider different corner cases separately. Admittedly, proofs of the statement in question probably cannot be entirely coordinate-free, because the assumption that "$A$ is not triangular" is already basis dependent, but I still want to see a more conceptual proof that isn't just a series of algebraic manipulations. Any idea?
P.S. Since the analogous statement also holds when $A$ is $2\times2$, I also wonder if it is true for all sizes of $A$.