There was a first season episode of Enterprise where Archer had a monologue towards the end regarding his choices in regard to interfering with the alien species of the week. During that he suggested they really needed some ground rules regarding this sort of situation that officers could reference and know when to just walk away. He was plainly alluding to the Prime Directive, although it was kind of silly to suggest that nobody had given this serious thought in the centuries before interstellar travel became a reality for Earth and the decades since slow-ish interstellar travel became available. (One of the bridge officers had grown up on his family's trading vessel, suggesting humans could have been mucking around with various planets well before Starfleet ever showed up.) Obviously most of the species who could have passed through the neighborhood had non-interference policies or the planet would have been openly visited long ago, rather than by secret agents like Gary Seven.
Hey, it can be worse. One of the episodes of the animated Trek series used a Larry Niven Known Space story, 'The Soft Weapon,' as the basis of a Star Trek story. This meant dragging in a huge chunk of Known Space backstory about a war that wiped out nearly all sentient life in the galaxy about 3 billion years ago. Making this work entailed substituting Sulu and Uhura for the original human characters. It also meant bringing in Nesus, the Puppeteer, and the Kzinti.
They could have had Klingons instead of Kzin, especially since they did a horrible rendition of the rat-cats. This left the question of whether Puppeteers and Kzin are part of the Trek universe or not. Most choose to ignore that episode or even the whole animated series, although it did introduce characters like Robert April, the first captain of the Enterprise and its primary designer, IIRC.
So that was a big hairball of complication. I remember some of the pen and paper Trek RPG games treated the Kzin as part of the package but largely so that they had another popular species with speciifc battle tactics. I remember Dragon magazine, which was the official publication of TSR, the original publishers of D&D, had a section where people created versions of characters from mythology and fiction in D&D playable form. (Giants in the Earth?) One issue had D&D Kzinti using the premise that they'd wandered through a dimensional rift from their home in the Known Space universe, which in turn lent the same premise to their turning up in Trek. Whee!
See, everything can be explained! You just have to memorize sufficient amounts of insane trivia instead of wasting your neurons on stuff like useless 'practical knowledge.'