They are related when $Y$ is a rank-2 matrix with eigenvalues. (say $\pm \lambda$)
Also, you need to prove the equality condition for the Holder's inequality in each case. You are using the equality condition without proving it.
Suppose $Y$ is a rank-2 matrix. Then equality case for Holder's inequality $Tr(XY) \leq |X|_1|Y|_\infty$ holds when $|Y|$ has an eigenvalue of $|Y|_\infty$, which is easy to show. So $max Tr(XY) = |Y|_\infty =\lambda$, and you're right that $|X|_{opt,1}$ is one of the suggested solutions.
The equality case for Holder's inequality $Tr(XY) \leq |X|_2|Y|_2 = \sqrt{2}\lambda|X|_2$ holds when $|X|^2 = a|Y|^2$ for some scaler $a>0$. When you think about maximizing trace, a natural choice would be aligning $X$ to $Y$, so that $X = a' Y$ for some scalar $a'$. This covers the equality condition trivially. Therefore, since $max Tr(XY) = |X_{opt,2}|_2|Y|_2 = \sqrt{2}\lambda $, $X_{opt,2}$ is just $\sqrt{2}$ multiplied by one of the $|X|_{opt,1}$ solutions suggested earlier. So they are related.
But in general case of $Y$ being a random Hermitian operator, this is not true at all.