This same situation happened to me and Brand in a custom game on the opening blitz a month or two ago.
I raced in to claim a critical border star with extra force, because by the way I understood the mechanics I would have gotten the defender bonus. Game said I was wrong, and I got slaughtered…
The “distance traveled” should be “total distance from the previous destination”, i.e. closest owned star (travelled from) gets the bonus. This logically makes more sense to me. Why would you grant the defender bonus to the guy actually traveling FARTHER from his last star? Seems like the bonus should go to the guy closer to the area or cluster, not the one “invading” from afar.
The math describing the “distance since last tick” above makes sense why I lost now (though I do wonder about distances when more than a couple decimal places seem to matter but we have no visibility - this matters for scanning and hyperspace range, but should be a different topic altogether). That is not how I understood it though given my reasoning above.