It was rare because they actually did consider him sentient. There's of course the famous episode Measure of a Man, but the one I remember is when Picard indirectly threatened Data in Clues, when he found out Data was keeping a dangerous secret from the rest of the crew.
PICARD: "Do you know what a court-martial would mean? Your career in Starfleet would be finished. Do you also realize that you would most likely be stripped down to the wires to find out what the hell went wrong?"
This is fairly directly inferred in Interstellar, as well, with TARS and whatever the other robot was called.
Like, he directly threatens TARS with that at least once, so, yeah, it's definitely a trope...
Can sort of argue that Star Trek did this with Data, on occasion, too...
It was rare because they actually did consider him sentient. There's of course the famous episode Measure of a Man, but the one I remember is when Picard indirectly threatened Data in Clues, when he found out Data was keeping a dangerous secret from the rest of the crew.