There are two ways to go for the car that is behind. If they think they are faster, they can stop sooner and run faster on the new tires and might end up ahead of the leader when the leader makes a pit stop as they will have to for fuel. Teams know how long the pit stop will take so they try to time it where they will come out in less traffic so they can make full use of the faster tires. The leader should never stop first, unless they have to because they will be on equal tires until the second place car stops. In Formula One it's a little easier because there are fewer cars and the speed differential between the top few cars and the field is much greater so they get strung out farther leaving lots of gaps. In Formula one, they don't add fuel and only have one mandatory stop for tires. If they can make the second set last until the end, they don't have to stop again which gives them an 18 to 20 second security gap. The second place car has to worry about the first place car not stopping. It is also very difficult to pass in Formula One even with a faster car. Not quite as difficult in NASCAR.
I'm sure Harvick had enough of a cushion that he would have had the lead if he waited until one lap after Truex pitted. We don't know what the plan was. Maybe Cole Pern had Truex watch what Harvick did. If Harvick stopped, Truex would stay out to have fresher tires later. If Harvick didn't stop, Truex might have and split it into a two stop run to have fresher tires at the end and hope for a late caution.
It isn't the same as a shorter track late race caution where the leader is almost forced to change tires because if they don't, all the others will and being in front doesn't help if the second place car has better tires. If the leader does stop, the next ten cars might not so even the fresh tires won't help passing ten cars.