Taking credit feels good and admitting fault hurts, so the two sides need different amounts of evidence
In the year your half marathon was faster, as soon as the thought "the new plan worked" came up, you believed it. It made you happy, so you didn't question it further. In the slow year, "I didn't train enough" hurt, so you looked for other explanations first, and only owned up when you really couldn't find one.
Put this difference in strictness into numbers, and look at it in two steps. Step one: when you run faster, a single point of "what I did right" is enough for you to claim the credit; when you run slower, you need to collect 3 points of "this was my fault" before you admit it. Step two: in any one race, there are usually one or two details in your favor and one or two against you. So when you run faster, 1 point is enough, and the credit goes to you; when you run slower, you can't collect 3, so the cause lands on the wind and the water station. If both sides needed only 1 point, in the slow year you would have to admit "I didn't train enough," and you couldn't bring yourself to blame the headwind.
The more something touches your pride and your interests, the further apart the two bars
How far apart the bars are depends on how much the thing matters to you. For a quick quiz in class, it hardly matters how you explain doing well or badly, and the two bars are about the same. For a promotion interview or a whole year's results, losing costs more, and the bar for admitting fault is raised higher. And a review is also told to coworkers and family, so what you're protecting is not just your picture of yourself but how others see you.
Even when pride isn't at stake, unexpected results get pushed outside
Self-serving bias has another source that has nothing to do with feelings: people only look for causes when a result is unexpected. You prepared two weeks for an interview and passed; that was expected and needs no explaining. Failing is a surprise, so you look for a cause; but you know you put in plenty of work, so the cause can only be looked for outside: the interviewer asked odd questions, you weren't on form that day. Researchers have long argued about which of these two sources matters more, but the end is the same: nobody questions what went smoothly, and what went wrong gets pushed out the door.
When an outside cause has an independent record you can check, putting the cause outside is correct: for example, if a power cut stopped work, the grid has records you can check against. Using this model to push a coworker to "look at yourself first" just turns the bias around, and still doesn't check the records.