> but the second goes over capacity
This is not how "capacity" works.
It is not that there is some constant limit to something, and everything is 100% fine as long as you are under capacity, but breaks entirely when you go over capacity.
Instead, capacity is flexible, and there are costs to it being flexible.
Instead, capacity is something that you start bumping up against, and this starts to cause problems. And the more that you bump up against capacity, the more problems that you get.
So, if you are only slightly over capacity, it means that, your roads will be a little bit congested some but not all of the time, or the town will have to purchase a little bit of energy from the town next over (or raise prices a little bit during certain times of the day to reduce demand), or a school will have a little bit more people attending it than previously intended, or you'll have to pay the police overtime hours more often.
And when these problems get big enough, THEN, people will decide that it makes sense to upgrade the network.
That solves your step wise function, that you are talking about. "Capacity" is actually pretty flexible. And you don't have to do some maximum upgrade, if you go over it. You can instead wait until you are over capacity enough that it makes sense to do the upgrade.