That's an interesting one all right. In his meditative voiceover, Spock reveals he is aware of the class distinctions, and declares them unwise but not illegal. Since this is Spock, we don't learn whether he is surprised by his recent discovery of the class injustice, or just commenting on something he has known for ages.
Soon thereafter, when Droxine and Vanna argue, Kirk appears surprised that the Troglytes don't get to share in the benefits of the society they help support. Spock again mostly just neutrally comments, but then declares "unthinkable" the physical banishment of the Troglytes to the harsh surface.
So we have evidence that the degree of separation between the castes is appalling to our heroes, but none that its very existence would be. And in the end, Kirk is both powerless at and disinterested in changing the state of affairs, and his superiors don't appear to expect that he do something about it, either. To the contrary, Plasus argues his policies and practices enjoy the protection of UFP law that grants him autonomy on such matters. (Or at least immunity against a Starfleet officer trying to interfere, although if a non-Starfleet authority had broader powers, Plasus' attitude would make little sense because surely Kirk would go complain to such an authority to effect the change then.)
Kirk, as usual, resorts to crime and violence to get what he wants. But that's zenite, not democracy. He ultimately washes his hands of the whole affair, and status quo is retained. Were the vile practices on the planet somehow in excess of the laws that the UFP upholds, this would be an unlikely outcome. Were the laws presented to the UFP different from the actual laws in force on Ardana, doubly so. But how could the laws be "democracy on paper" if they aren't in conflict with what takes place? It looks as if the UFP knows of and condones what is happening, despite some excesses it wasn't aware of.
Timo Saloniemi