In fact what you need is that your ∞-category is *additive* (i.e. that it has direct sums and that the canonical commutative monoid structure on the mapping spaces is group-like). All stable categories are additive, so I'll just prove it in this case.

**Step 1**: The pullback $X\times_Z Y$ is equivalent to the pullback $(X\times Y)\times_{Z\times Z}Z$. This fact is true in every ∞-category with finite limits

I'm sure there are many ways of proving this. One way of doing it (thanks to Omar Antolín-Camarena for the idea) is to consider the diagram

$$\require{AMScd}
\begin{CD}
Y @>>> Z @<<< Z\\
@VVV @VVV @VVV\\
\ast @>>> \ast @<<< Z\\
@AAA @AAA @AAA\\
X @>>> Z @<<< Z
\end{CD}\,,$$

where $\ast$ is the terminal object. Taking the limit first in the horizontal direction and the in the vertical direction we obtain $X\times_Z Y$, while taking the limits in the opposite order we obtain $(X\times Y)\times_{Z\times Z}Z$. Since both methods compute the limit of the whole diagram, the two objects must be equivalent.

**Step 2**: The diagonal $Z\to Z\oplus Z$ is the fiber of the "difference" map $Z\oplus Z\xrightarrow{(1_Z,-1_Z)} Z$

This is where we use the additivity hypothesis. Recall that one way of phrasing that the ∞-category is additive is that the shear map
$$Z\oplus Z\xrightarrow{\left(\substack{1\, 1\\ 0\, 1}\right)} Z\oplus Z$$
is an equivalence. Then there is an equivalence of sequences
$$\require{AMScd}
\begin{CD}
Z @>{\left(\substack{0\\1}\right)}>> Z\oplus Z @>{(1\,0)}>> Z\\
@| @V{\left(\substack{1\,1\\0\,1}\right)}VV @|\\
Z @>{\left(\substack{1\\1}\right)}>> Z\oplus Z @>{(1\,-1)}>> Z
\end{CD}$$
Since the top one is a fiber sequence, so is the bottom one.

**Step 3** Profit!

Let us consider the following diagram
$$\require{AMScd}
\begin{CD}
X\times_Z Y @>>> Z @>>> 0\\
@VVV @V{\left(\substack{1\\1}\right)}VV @VVV\\
X\oplus Y @>{(f\,g)}>> Z\oplus Z @>{(1\,-1)}>> Z
\end{CD}$$
Since the left and right squares are cartesian (by step 1 and 2), so is the big one, which was the thesis.

*Bonus question:* In every $\infty$-category with finite limits, if you have a square of pointed objects
$$\require{AMScd}
\begin{CD}
F @>{a}>> X\\
@V{b}VV @V{f}VV\\
Y @>{g}>> Z
\end{CD}
$$
there is a canonical equivalence between the fiber of the map $F\to X\times_Z Y$ and the fiber of the induced map $\mathrm{fib}(a)→\mathrm{fib}(g)$. This can be proven as before, by considering the diagram
$$\require{AMScd}
\begin{CD}
\ast @>>> X @<<{a}< F\\
@VVV @V{f}VV @V{b}VV\\
\ast @>>> Z @<<{g}< Y\\
@AAA @A{g}AA @AA{1_Y}A\\
\ast @>>> Y @<{1_Y}<< Y
\end{CD}\,,$$
and taking the limit in the two directions (you can find more details in the first section of this paper). Incidentally this object is called the *total fiber* of the square.

Since in a stable ∞-category a map is an equivalence iff the fiber is trivial, this gives an affermative answer to your query.