Note : I realized that this answer is probably not recommended in an exam, but in any case it's useful to know.
One can use the "multiple product" rule for differentiation. Let's write $f'$ for $\frac{df}{dx}$ for this answer. We know that $(fg)' = f'g+fg'$ is the product rule, but as an extension (by induction), one can show that $$(f_1f_2\ldots f_m)' = \sum_{j=1}^m f_1f_2\ldots f_{j-1}f_j'f_{j+1}\ldots f_m$$ for functions $f_1,\ldots,f_m$. This rule is usable in your situation, instead of taking the logarithm. (Roughly, you sum over all possible products of $m$ functions where exactly one of the functions is differentiated and the others are not).
However, you need to look ahead. When you get to $$
\lim_{x \to 0} \frac{-\frac {d}{dx} \prod_{j=2}^{n} (\cos jx)^{\frac 1j}}{2x}
$$
You know that, in hindsight, this needs to equal $10$. However, the denominator evaluates to $0$ at $x=0$, so you actually need to differentiate the numerator once more as well, because you need another round of L'Hospital's rule to make the $2x$ into $2$ and make the denominator well defined and get a limit which is not equal to $0$ or $+\infty$, but some finite number.
It turns out that, similar to the multinomial theorem, one has a rule for differentiating a product of functions as many times as necessary. It's the "ultimate" product rule.
"Product rule" : If $f_1,\ldots,f_m$ are functions and $L$ is the number of times you need to differentiate $F = f_1\ldots f_m$ then the $L$th derivative of $f$ equals $$
F^{(L)} = \sum_{k_1+k_2+\ldots+k_m = L, k_i \geq 0} \binom{L}{k_1,k_2,\ldots,k_m}f_1^{(k_1)}f_2^{(k_2)}\ldots f_m^{(k_m)}
$$
where $\binom{L}{k_1,k_2,\ldots,k_m}$ is the multinomial coefficient.
See here for details on this rule.
What you need is to differentiate the numerator $\prod_{j=2}^{n} (\cos jx)^{\frac 1j}$ two times. According to this rule, you will obtain $$
\sum_{k_1+k_2+\ldots+k_n = 2, k_i \geq 0} \binom{2}{k_1,k_2,\ldots,k_n}\left((\cos 2x)^{\frac 12}\right)^{(k_1)}\ldots \left((\cos nx)^{\frac 1n}\right)^{(k_n)}
$$
Thankfully, this is not too difficult when you realize that only one of two things can happen.
In the first case, the first derivative of $(\cos ix)^{\frac{1}{i}}$ is $$
\left((\cos ix)^{1/i}\right)' = (\sin ix)(-\cos^{1/(i-1)}(ix))
$$
which equals $0$ when evaluated at $0$. So this case gives $0$.
In the second case, we differentiate again using the product rule to get $$
\left((\cos ix)^{1/i}\right)'' = (\cos^{1/(i-2)}(ix))(-(i-1)\sin^2(ix)-i \cos^2(ix))
$$
at $0$, this equals $-i$. The multinomial coefficients are all equal to $1$ in this case, so we land up with $$
\left(\prod_{j=2}^{n} (\cos jx)^{\frac 1j}\right)'' (0) = -2-3-\ldots-n = 1-\frac{n(n+1)}{2}
$$
Plugging this back into the original L'Hospital rule, the limit of the quantity you want as a function of $n$, is then equal to $$
\frac{\frac{n(n+1)}{2}-1}{2}
$$
(the $2$ denominator comes from differentiating the $2x$ at the bottom during the $2$nd L'Hospital round).
If this is equated to $10$, then you get that $$
\frac{n(n+1)}{2} = 21 \implies n=6
$$
as desired.
This method is the "brute force" way of extending the original post's approach. It requires one heavy tool, but that tool finds a lot of usage in analysis of products in the future (and can be made slightly easier if one uses the cosine Taylor series) and I think it's a nice thing to know at the high school level.