I agree that [tex]\cos(x)^2[/tex] is at least a little ambiguous, and therefore risky to use, especially with inexperienced readers.
In a context where one always uses parentheses around function arguments, it is not ambiguous. So programmers will have no doubt as to what is intended.
But in trig and log problems in textbooks, it is still common to use the old, pre-function notation where [tex]\cos x[/tex] or [tex]\log x[/tex] is acceptable. And in that context, consider a slightly worse case: [tex]\cos(x+1)^2[/tex]. Here, the parentheses might be present to mark the argument, [tex]x+1[/tex]; or they might be there to distinguish the base of the power, the whole thing being the argument.
In an ideal world, a little thought may make it clear that the parentheses are intended to hold the argument; but expecting everyone to think carefully is "blaming the victim". Consideration for the reader demands that we remove stumbling blocks in case they are not accustomed to seeing things the same way we do. That's how good communication works: the transmitter plans the content to prevent errors on the part of the receiver, rather than putting the entire burden on the receiver.
Bookmarks