The two and a half year figure is for Kirk's time as Chief of Starfleet Operations. The Enterprise rebuild was one and a half years. We know from the TNG episode Cause and Effect the year they were already wearing the maroon jacketed uniform coats. Captain Kelsey said it out loud.

Problem is in canon we don't exactly know when the TOS five year mission took place, which years. That part is loose conjecture.

Between the time the Enterprise returned to Earth and the events of TMP, up to a decade easily could have passed.

My personal preference is that after fairly brief refit, command of the Enterprise was turned over to Will Decker and he took her out again. Years and many missions later, Decker brought the Enterprise back to Earth (by this time Kirk is already CoSO) and the rebuild process began.

A year and a half after that, the events seen in the first movie.

Star Trek Voyager episode "Q2" established that Kirk's five year mission actually ended in 2270.