The gemara says that one's own aveida comes before an aveida of someone else. This is learned from a pasuk of אפס כי לא יהיה בך אביו - שלך קודם לשל כל אדם. This drasha would make sense in a situation where it is a very valuable item and the loss would lead to poverty, but how does this explain why one has the right to retrieve his own coat before that of someone else - that won't lead to poverty? I found the answer in the pirush hamishna of the Rambam:
והרמז מן התורה שיש לאדם להקדים עצמו על זולתו, הוא דאמר רחמנא וכו' כאילו אמר אין אתה חייב להסיר רעה מאחר אלא כשלא יבא לך כעין אותה רעה, שהסירות ממנו כי אם תהיה בענין שאם תתן לאביון די מחזורו תשוב אתה עני כמוהו אינך חייב לתת לו
The rambam interprets this as a mashal. Just as when protecting oneself from poverty he has the right to prioritize himself over others, so too when it comes to protecting his property on a smaller scale he has the right to prioritize himself over others.
But the gemara warns - כל המקיים בעצמו כך סוף בא לידי כך. Rashi explains that this is a warning that in general a person should go lifnim mishuras hadin and prioritize his friends aveida, unless it is a "hefsed mochi'ach" - meaning that his loss is definite and not just a possibility. Rashi seems to hold that me'ikar hadin one has the right to prioritize a safeik loss to himself over a definite loss to someone else, but recommends that one go lifnim mishuras hadin and forfeit any safeik loss to himself when there is a definite loss to someone else. But, a definite loss to himself he is not obligated to forfeit even lifnim mishuras hadin.