That was a production mistake that was later retconned.In S1 of TNG, the USS Yamato had the registry NCC-1305-E. So, the practice has been in place for some time.
https://memory-alpha.fandom.com/wiki/USS_Yamato#Background_information
According to Star Trek Encyclopedia (4th ed., vol. 2, p.505), the initial NCC-1305-E registry number was a production mistake. It was given to the Yamato by the episode writer Jack B. Sowards, who was unaware of the registry numbering scheme developed for Star Trek: The Next Generation. Michael Okuda had intended to correct the number, as he had already finished the decals for the saucer section of the model for "Contagion", but as the scene was removed from an intermediate draft, he dropped the issue, only to find out the scene had been re-added later on to the final draft, which Okuda realized after the episode had aired.