As you noted, it's obvious that $\prod_{i=1}^k p_i^{a_i}$ (where $p_i$ is prime and $a_i\geq 1$) and $\prod_{i=1}^k p_i$ will have the same result when the sum is evaluated, so let's just assume that $n=\prod_{i=1}^k p_i$
Denote $S_i$ as the set of all divisors of $n$ that contain exactly $i$ prime factors. For example, $S_0=\{\}$, $S_1=\{p_1,p_2,\ldots p_k\}$ and $S_n=\{p_1p_2\ldots p_k\}$.
Our sum is equivalent to
$$\sum_{i=0}^k\sum_{s\in S_i} \mu(s)\log^2(s)$$
$$=\sum_{i=0}^k (-1)^i\sum_{s\in S_i} \log^2(s)$$
While we can directly compute this inner sum, it will be better to exploit symmetry. For a fixed $i$, we will have $\binom{k}{i}$ different possibilities for $s$. We will then expand $(\log s)^2$, where $s$ is a product of $i$ primes. For any $s$, this expansion will have $i$ terms of the form $\log^2 p$ (where $p$ is a prime) and $i(i-1)$ terms of the form $(\log p)(\log q)$ (where $p$ and $q$ are distinct primes). Using the fact that this sum is symmetric, we get that for a fixed $i$,
$$\sum_{s\in S_i} \log^2 (s)=\frac{i}{k}\binom{k}{i}\sum_{j=1}^k \log^2 (p_j)+\frac{i(i-1)}{k(k-1)}\binom{k}{i}\sum_{\substack{l,m\in [1,k]\\l\neq m}}(\log p_l)(\log p_m)$$
We can define the sums $\sum_{j=1}^k \log^2 (p_j)$ and $\sum_{\substack{l,m\in [1,k]\\l\neq m}}(\log p_l)(\log p_m)$ as constant $P_1$ and $P_2$. Hence, our original expression is equivalent to
$$=\sum_{i=0}^k (-1)^i\left(\frac{i}{k}\binom{k}{i}P_1+\frac{i(i-1)}{k(k-1)}\binom{k}{i}P_2\right)$$
$$=\sum_{i=0}^k (-1)^i\left(\binom{k-1}{i-1}P_1+\binom{k-2}{i-2}P_2\right)$$
$$=P_1\sum_{i=0}^k \binom{k-1}{i-1}(-1)^i+P_2\sum_{i=0}^k\binom{k-2}{i-2}(-1)^i$$
When $k-2>0$, using binomial theorem, both of these sums evaluate to $0$, hence our expression is equivalent to
$$=P_1(0)+P_2(0)$$
$$=\boxed{0}$$