David Gerrold actually wrote about that in his book. He said he had read the Heinlein story, but had completely forgotten about it until well after his screenplay was written. It wasn’t until someone brought up the similarity to flatcats that he remembered—it may even have been after the episode aired.Although I think they have denied it, it was a ripoff of a Robert Heinlein story called The Rolling Stones. The Tribbles were retreads of Martian Flatcats. Edit: That being said, it still was well written. It was written by David Gerrold, another scifi author.