But how would they go back in time and replace themselves?
Bingo. Again, we run up against the nonsense of time paradoxes. Depending on which church of physics you belong to, time travel may not even be possible. (Not that we simply don't know how to do it, but actually impossible.) Since no one has time traveled, or at least documented their account of such, sci-fi stories must fall back on logic. Invoking paradoxes chucks out logic, meaning the writer can do anything he wants, and the reader must simply accept it.
Some writers try to BS their way around the problem with quantum explanations—the root of "magic" in real physics. (Theoreticians can declare anything they want because they have math that "proves" it.) For example, Orson Scott Card's PASTWATCH depicted time as quantized, like the frames of a film. Thus, when the traveler was displaced backward in time to alter history, his own existence became an effect without a cause. History, right up to the moment he was displaced, was altered, along with his stepping into the time machine. But the "frames" of his existence after displacement continued to exist without a cause. Ergo, magic.
This approach is fatally flawed. It completely nullifies causality because the traveler can exist without a cause. Yet the whole point of altering history is to create a desired chain of causality. The writer can't have it both ways. If he nixes causality, one could rightly expect all of existence to be random flashes of entirely discontinuous things every "instant" of time.
Another problem with the a-causal time travel is that time becomes both directional and non-directional. By time traveling, the writer is showing that effects can precede causes. Yet for some reason—just because the writer wants it that way—the chain of causality runs only forward into the future, but not backward to eliminate the time traveler.
"City" never gets into such explanations, it merely invokes several paradoxes. Ellison could have kept logic on an even keel by invoking alternate universes. In which case, McCoy would have disappeared into an alternate time, with Kirk and Spock having to chase him down. But the Enterprise
would still exist and the landing party would not be abandoned in time. Also, Kirk might have stayed in the alternate history with Keeler. The others would then have to appeal to his sense of duty to return, to not abandon his command. (That's not as emotionally compelling as the "saving millions of lives from Hitler" argument used in the episode.)
Logic destroys the schmaltzy, star-crossed lovers appeal of "City." I enjoy the episode for its atmosphere, but it is a "check your brain at the door and just emote" tale. That is why I do not rate the episode among TREK's best. Ellison could have crafted a tale where the characters were truly and logically trapped by time and fate, but settled for "good enough," the hallmark of most television writing.
"Tomorrow Is Yesterday" actually puts the "replacing themselves" idea on screen, with the beaming of the pilot and the air sergeant directly into themselves. Explain that one, and why it is that both suddenly forget everything.
While I'm on a roll, let me comment on SEVEN DAYS, a time travel series where a special agent can be sent back in time just seven days to alter catastrophic events in the world. I haven't seen every episode, but if I remember correctly, the time travel missions were chosen carefully, as the amount of exotic fuel was limited. However, if the writers had really thought about it, the fuel would never run out. Each time the agent time traveled, he erased the need for his trip in the first place—weekly paradoxes. This means that he would never have traveled, and thus the fuel would never run out. Perpetual motion.
Again, take any time travel story that invokes paradoxes with a grain of salt. Compare "City" to "Assignment Earth," which is a reflexive causality, but not a paradox.