$\newcommand\la\lambda$

 1. Let $g(z)$ denote some branch of $\sqrt z$, so that $Q(z)=P(z)^2-g(z)^2$ and $P^{(k)}(\la_j)=g^{(k)}(\la_j)$ for each $j$ and all $k=0,\dots,m_j-1$, where the $\la_j$'s are the distinct eigenvalues of $A$ and the $m_j$'s are their multiplicities. Then, by the [Leibniz rule][1], $Q^{(k)}(\la_j)=0$ for each $j$ and all $k=0,\dots,m_j-1$. 

 2. So, the $\la_j$'s are roots of $Q(z)$ with respective multiplicities $n_j\ge m_j$ for each $j$. So, for some polynomial $R(z)$,
$$Q(z)=R(z)\prod_j(z-\la_j)^{n_j}=R_1(z)\prod_j(z-\la_j)^{m_j}
=R_1(z)C(z),$$
where $R_1(z):=\prod_j(z-\la_j)^{n_j-m_j}R(z)$ is a polynomial and $C(z):=\prod_j(z-\la_j)^{m_j}$ is the characteristic polynomial of $A$. So, the polynomial $Q(z)$ is indeed a multiple of the characteristic polynomial of $A$.

(The [previous answer][2], referred to in your question, does not even mention indices.)

---

**In response to the requests for details in a comment by the OP:** 

>1. Why is $n_j\ge m_j$? How can we know this for certain? 

This follows from 

>**Lemma 1:** Let $q(z)$ be a polynomial such that $q^{(k)}(\la)=0$ for some $\la$ and all $k=0,\dots,m-1$, where $m$ is an integer $\ge1$. Then $\la$ is a root of $q(z)$ of a multiplicity $n\ge m$ -- that is, $q(z)=(z-\la)^m S(z)$ for some polynomial $S(z)$ (which may or may not have $\la$ as a root, of some multiplicity). 

*Proof of Lemma 1:* By shifting, without loss of generality $\la=0$.
Divide $q(z)$ by $z^m$ with a remainder $r(z)$ of degree $\le m-1$, so that $q(z)=z^m s(z)+r(z)$ for some polynomial $s(z)$. Then for all $k=0,\dots,m-1$ we have $0=q^{(k)}(0)=r^{(k)}(0)$. Because $r(z)$ is of degree $\le m-1$, it follows that $r(z)$ is the zero polynomial, so that $q(z)=z^m s(z)$, which completes the proof of Lemma 1. $\quad\Box$ 

>2. We obtain that $\la_j$ are the roots of $Q(z)$ but why do we need to show that the derivatives of $Q(t)$ equal 0 at each $\la_j$ for this? Is showing that $Q(\la_j)=0$ for each $j$ not enough? 

Not in general. If, say, we had the following for some $j$: $\la_j=0$, $m_j\ge2$, and $Q(z)=zQ_1(z)$ for some polynomial $Q_1(z)$ with $Q_1(0)\ne0$, then we would have $Q(0)=0$ but the multiplicity of the root $0$ of $Q(z)$ would be $1\not\ge m_j$.  

>3. Where does $R(z)$ come from? Since we know the roots and multiplicities of $Q(z)$, shouldn't $R(z)$ not be a constant instead of a polynomial? 

Whether $R(z)$ is a constant or not is irrelevant to the proof -- we just need $R(z)$ to be a polynomial. Anyhow, if we only know that the $\la_j$'s are roots of $Q(z)$ with respective multiplicities $n_j$ for each $j$, then $Q(z)$ can be $R(z)\prod_j(z-\la_j)^{n_j}$ for any polynomial $R(z)$ whatsoever. 

  [1]: https://en.wikipedia.org/wiki/General_Leibniz_rule
  [2]: https://mathoverflow.net/a/438232/36721