I agree with this, and I feel that even the realistic, flawed human beings of the 23rd century should be at least a little more enlightened than us mouth-breathing 21st-century primitives, and it would show in their comportment. Yes, people swear a lot today. But Star Trek does not take place today. It takes place in a more enlightened, civilized and cultured future.
They are. It is not a situation where swearing is used as a term of abuse. It is not used to threaten or degrade. It is not used casually, reflecting a lack of imagination and vocabulary or a generally vulgar nature.
It is a word which slips out in a moment of awe, is immediately seen as inappropriate and surprising, but is generously adopted by the superior officer given the special nature of the moment and the very human reaction it elicited.
That is not in the slightest way incompatible with "a more enlightened, civilized and cultured future".