Given a morphism $Y\rightarrow Z$ and morphisms $X_1\rightarrow Y$, $X_2\rightarrow Y$, the magic diagram is given by the diagram
The question I have is about the map on the right. There are three different maps that could refer to, as far as I can tell. Consider the following diagram:
The maps $Y\rightarrow Y$ are the identity maps. The issue I'm having is that this diagram is not commutative: there is no reason the $X_1\times_ZX_2\rightarrow X_i\rightarrow Y$ for $i=1,2$ should agree. Indeed, suppose we are in $\mathsf{Set}$ and the $X_i$ and $Z$ are singletons and $Y$ is a two-element set, where the maps $X_i\rightarrow Y$ pick out different elements of $Y$. Then $X_1\times_ZX_2$ is a singleton, so the maps $X_1\times_ZX_2\rightarrow X_i\rightarrow Y$ do not agree - in general all we know is that they do agree once compose with $Y\rightarrow Z$.
So there are two possible maps $X_1\times_ZX_2\rightarrow Y\times_ZY$, given by $X_1\times_ZX_2\rightarrow X_i\rightarrow Y\rightarrow Y\times_ZY$, as in the diagram. And these definitely aren't equal in general, for if they were, knowing $Y\rightarrow Y\times_ZY\rightarrow Y=\text{id}_Y$, we would then be able to conclude the $X_1\times_ZX_2\rightarrow X_i\rightarrow Y$ are equal.
I have seen this answer, but I think the same issue arises (in fact I based that diagram off the one in the answer), that there are two maps from $X_1\times_ZX_2$ we could use. Even if we ignore this and just choose one of them, while commutativity of the magic diagram becomes easy to show, I'm not sure about the universal property. For example, suppose we have the following diagram:
These maps are given such that the red and blue paths are equal after composing with $Y\rightarrow Y\times_ZY$, which means they must actually be equal (seen by then composing with $Y\times_ZY\rightarrow Y$ since the arrows $Y\rightarrow Y$ are the identity). But I don't see why the blue map should be equal to $A\rightarrow X_1\times_ZX_2\rightarrow X_2\rightarrow Y$, just because they are equal after composing with $Y\rightarrow Z$. As a result I'm not sure how to get two maps $A\rightarrow X_i$, equal after going to $Y$, which would give me the desired $A\rightarrow X_1\times_YX_2$.
There is a third possibility for the map $X_1\times_ZX_2\rightarrow Y\times_ZY$, using the universal property of $Y\times_ZY$. This comes from the two not-necessarily-equal maps just mentioned from $X_1\times_ZX_2$ to $Y$. Since these are equal after composing with $Y\rightarrow Z$, they must each factor through $Y\times_ZY$, as in the following diagram:
If the map $X_1\times_ZX_2\rightarrow Y\times_ZY$ came from this diagram, I don't know how to show the magic diagram is commutative, although it is easy to show that if it is, then it's also a pullback.
I'm wondering whether my reasoning so far is correct. I rather suspect my "universal property morphism" is the correct morphism and not the ones which go through the $X_i$ but I don't know how to then finish the problem.