Several things are not worded in a fortunate way there.
First of all, the answer writes "maximal abelian subalgebras" and links "abelian subalgebra" to an article on "toral subalgebras". Now in general, a maximal abelian subalgebra is not the same as a maximal toral subalgebra. These things are identical only in case our Lie algebra is a compact semisimple or reductive real LA (like $\mathfrak{u}(n)$), so it is sloppy to just mix that terminology there. Cross out "abelian", write "toral".
Next, maximal toral subalgebras are identical to Cartan subalgebras in any semisimple (or even reductive) Lie algebra over any characteristic $0$ field. See https://math.stackexchange.com/a/2497093/96384. So the sentence "The centralizer of a maximal toral subalgebra is called the Cartan subalgebra" is misleading, as there is no need to take a centralizer here. (I mean, technically one can, because in hindsight, these things are also self-centralizing, i.e. they are identical to their own centralizers, but still that is a bad way to express that.)
Speaking of bad expressions, one should also say "a Cartan subalgebra" and not "the Cartan subalgebra". Any nontrivial semisimple Lie algebra has infinitely many such CSA's a.k.a. maximal toral subalgebras.
Next, the quoted fact that the subalgebra of all diagonal matrices forms a (not "the") CSA a.k.a. maximal toral subalgebra in the full matrix algebra $\mathfrak{gl}_n$ is very good to know, but falls short of relevance here.
Some underlying idea here might be: A CSA a.k.a. maximal toral subalgebra of $\mathfrak{u}(n)$ is given by the diagonal matrices inside $\mathfrak{u}(n)$. This subalgebra is abelian, hence everything in there commutes, and it has dimension $n$, so we can even choose $n$ linearly independent such matrices. Finally, if we conjugate a CSA, we get another CSA, so we could also use any such conjugation and get a different set of matrices in our Lie algebra, which are still linearly independent and commute with each other.
Well so far so good. Problem being that where I come from, the Lie algebra $\mathfrak{u}(n)$ consists not of hermitian, but of skew-hermitian matrices; correspondingly, those diagonal matrices in that answer with $1$'s on the diagonal are not even contained in $\mathfrak{u}(n)$. While conversely, the hermitian matrices do not form a Lie algebra.
Probably there is some way to fix those problems, but I would concur that that answer you link to would be better if one just ignores everything after the first line and equation.
Added in hindsight: Maybe the answer there should have just said that those $D_m$ ($m=1, ..., n$), belong to a (maximal) torus in the group $U(n)$. In particular, they all commute with each other. And so if you conjugate all of them with the same element of that group, you get a new set of hermitian matrices which all commute with each other. That's it. Going to the Lie algebra adds little insight, in particular when it's done with all those imprecisions.