TITLE: Matrices $B$ that commute with every matrix commuting with $A$
QUESTION [12 upvotes]: There have been many questions in the vein of this one, but I can't find one that answers it specifically.

Suppose $A,B\in M_n(\mathbb C)$ are two matrices such that, for any other matrix $C\in M_n(\mathbb C)$, $$AC=CA\implies BC=CB.$$ Prove that $B=p(A)$ for a polynomial $p\in\mathbb C[t]$. 

Nothing is assumed about $A$ being diagonalisable or having distinct eigenvalues or being invertible.
Edit: after further work, this might not actually be true. If it's not, a counterexample would be great.

REPLY [9 votes]: Reference: Lagerstrom, Paco, A Proof of a Theorem on Commutative Matrices, Bulletin of AMS, Volume 51 (1945), 535-536.
This holds for any field $\mathbb{F}$.
Let $M^A$ denote the $\mathbb{F}[x]$-module structure on $\mathbb{F}^n$. 
We use rational canonical form-invariant factor form. Then we have
    $$
    M^A \simeq \mathbb{F}[x]/P_1 \oplus\cdots \oplus \mathbb{F}[x]/P_r,
    $$
    where $P_i=(p_i)$, $p_i|p_{i+1}$.
    This gives invariant subspace decomposition,
    $$
    M^A =\bigoplus_{i=1}^r M_i,
    $$
    where $M_i\simeq \mathbb{F}[x]/P_i$. 
Let $\pi_i:M^A\longrightarrow M_i$ be the projection, and $\pi_{ij}:M_i\longrightarrow M_j$ be the natural projection for $i>j$. Extend $\pi_{ij}$ linearly to $M^A$ by assigning 0 on all $M_k(k\neq i)$. Then all $\pi_i$ and $\pi_{ij}$ commute with $A$, thus commute with $B$. Therefore, each $M_i$ is $A$-invariant, thus it is also $B$-invariant. 
Let $e_i\in M_i$ be the element corresponding to $1+P_i\in\mathbb{F}[x]/P_i$.
    We see that there is  $p(x)\in\mathbb{F}[x]$ such that $Be_r=p(A)e_r$. We claim that $Be_i=p(A)e_i$ for all $i<r$, and hence $B=p(A)$.
    $$
    Be_i=B\pi_{ri}e_r=\pi_{ri}Be_r=\pi_{ri}p(A)e_r=p(A)\pi_{ri}e_r=p(A)e_i.
    $$
    This completes the proof.