The Constellation in "The Doomsday Machine" could just have been named and numbered to honor the achievements of a previous starship with that name and number, not too dissimilar what happened to the starship that became the Enterprise-A.
Well, rather fundamentally dissimilar - the E-A had a registry unique to that starship, as far as we can tell. Bureaucrats wouldn't allow for it being impossible to tell apart the Constellation
from the Constellation
That would make sense. I think the only "exception" is with the Sao Paolo being renamed to the Defiant in DS9. Although the dialogue doesn't specify it, the later FX show the new Defiant with her old registry number.