From a purely monetary standpoint, it is def possible that buying a new car can be the best decision. I see the world differently. From an environmental perspective, it is almost always better to use something until it can't be used anymore.
But even if the range is no longer good enough for you it would be for someone else, so it wouldn't just get thrown away if you replaced it with a new vehicle. It would get used by someone else. (Or if the battery was really no good it would be used either for parts to keep other cars on the road, or as a "shell" to put a good battery in from a car that had a wrecked body.)