so if a goblin ambush occurs when the merchants do and the goblins kill all of them and you take the stuff from thier dead bodies, does that count as a loss to them and make them declare war on you? (even though its not your fault)
Yep.
If you want, think of it as a covenant with the traders that you shall do your utmost to protect them whilst in your realm. If you (by some perspectives) stand by and watch them get slaughtered, it's not much different from actively attacking them. To the source civilisation, you're just as bad. (And if none of the traders or their entourage make it back home alive, how would they know anyway? All they'd know is that their caravan was somewhere between the last stop and you when they disappeared.[1])
"But the ambush occured over on the other side of the map, I had no military or militia available to defend them, or get to them in time!" - You're the one that staked out the territory. If you're not prepared to rule over it and impose your authority, why did you claim such a large territory[2]?
That's an IC way of thinking of it, though I admit "it sucks" could be an apt way of talking about it, also.
As does a wandering hostile creature you're hoping to entrap getting in the way of a caravan and being slaughtered. And until you can send your own warriors out on active "containment" duty (e.g. wrestling it to the ground, non-fatally), rather than auto-attacking, the best you can hope for is to send a non-ranged warrior over and 'herd' them towards your traps/away from the caravan guards.
[1] One could argue for a sufficiently high "liar" or "pursuasion" skill, in your fortress's given representative, being able to deflect (or correct) such accusations towards the prior/next stopover who was 'actually' (or
actually) at fault, when the non-fudged external wanderings of caravans is brought in rather than the current analogue...
[2] Modifiable when the game gives long-term siegers who can actually set up settlement areas that you can only send military units into, or similar, or perhaps in currently-possible circumstances where they're wandering through a settlement that
you encamped near to, and have not yet siezed.