There's no hard and fast rule to this one. Plastic water bottles will last forever in practical terms. There's also not much available in terms of sustainably sourced water bottles. It's a piece of plastic that can't always go through the recycling system. These are all good reasons to keep using them as long as possible.
The challenge is that over time water bottles get difficult to use. The outsides get scratched and it starts to be harder and harder to get them out of the cages. They also start to look worn and can be hard to clean after a while. These are all reasons to replace them often.
Looking at both sides, there's no right answer. Replace them as infrequently as possible but do it when you need to. If you are careful about cleaning them, they will last longer. It's also helpful to clean the inside of your bottle cages from time to time as a way to extend the life of your bottles. If you want something that lasts even longer consider the Fidlock bottles and cages or a metal bottle instead of plastic.