It's 20 years from TOS to TSFS, and we know Pike had the ship for 10 years before Kirk thanks to "The Menagerie," so the ship is 30 years old, 40 if you count TAS. As of 1984.
Harve Bennett was probably counting the 5 year mission plus the time since the refit, which was left vague.
And in 1984, they weren't counting TAS.
He also probably left Pike out entirely simply because he didn't think of him or just wanted to simplify. If he said 40 years, you'd have literal minded super-fans being serviced but average film-goers wondering what's up. So, 20. In-universe, with the differences in the shooting model and crew size, it could have been a different vessel. They just didn't start slapping A's and B's on them yet (which I always hated anyway).
And considering the amount of space battles, giant green space hands energy barriers, asteroid fields, space clouds, giant amoeba's, and ion storms they encounter, not to mention the stresses of warp travel and so on, they get a lot more wear and tear than your car or an aircraft carrier sitting in the water off the coast of someplace launching jets and firing long range missiles. 20 years of that crap? I'd want a new ship too.
A ... reference to the age of the franchise.
The 20 year thing is off by two years - one if you go by the filming of the pilots and I'm not 100% convinced that Bennett - even with his dedication - was drilling down to the pre-production dates here. Especially since Kirk and Khan were reunited after "15 years" and this movie takes place a short time after the previous film. In universe time doesn't have to match the real world. If it did, years would pass between his films instead of days and weeks.
Bennett simply needed a narrative and, I assume, bureaucratic reason for Starfleet to mothball the Enterprise. It plays up the previous film's storyline of aging, gives Kirk a less than ideal ship to put into a crisis and then gives the old girl the opportunity to go out in a literal blaze of glory. At the same time, setting up the series for a new ship.
TL;DR: Star Trek set that precedent in 1984: 20 years being as okay point to retire a starship.