You're mixing up separate issues, though.
See, the reason you brought up trademarks is because I said names are not copyrightable in the U.S., in response to this:
QuoteAny distinctive element is protected. Naming a planet Coruscant or Tatooine, naming a fuzzy species a Wookie or Ewok, those are enough to classify something as a derivative work of the Star Wars universe.
This is not a statement about trademarks at all, because there is no such thing as a "derivative work" in terms of trademarks. It's clearly about copyright, where "derivative works" are an issue. So when you respond to me saying that names are not copyrightable in the U.S. by bringing up trademarks, that's completely irrelevant, a non-sequitur.
Yes, fangames especially do, very often, infringe trademarks. The worst of this is statements like "I do not own this game, XYZ does". But it's important not to confuse this very separate issue with copyright. Trademark infringement is not an inherent part of any cloning process, and not directly related to it; it can be avoided simply by not using the names in such a way that someone might reasonably infer that the owner of the trademark is responsible for the game. In any edge case, just put up a disclaimer (like every company does when comparing their products to their competitors'), and you're good.
(Note: I'm of course still not a lawyer and this is of course still not legal advice.)