Rudin said in his book Real and Complex Analysis about this that "It is sometimes useful to know the conditions under which equality can hold in an inequality. In many cases this information may be obtained by examining the proof of the inequality." I will try to follow his wisdom and examine a proof of the triangle inequality:
[Proof of the triangle inequality.]
We want to show that
$$
\|f+g\|_p\leq\|f\|_p+\|g\|_p\tag{0}
$$
When the RHS is $0$, the proof is trivial. Suppose it is positive. By homogeneity $\|cf\|_p=|c|\|f\|_p$ we may reduce to the case $\|f\|_p=1-\lambda$ and $\|g\|_p=\lambda$ for some $0\leq\lambda\leq 1$. The cases $\lambda=0,1$ are trivial, so suppose $0<\lambda<1$. Writing $F:=f/(1-\lambda)$ and $G:=g/\lambda$ we reduce to the convexity estimate:
$$
\|(1-\lambda)F+\lambda G\|_p\leq 1\quad\text{whenever } \|F\|_p=\|G\|_p=1\
\text{and }0\leq\lambda\leq 1.\tag{1}
$$
But since $z\mapsto|z|^p$ is convex for $p\geq 1$, we have the coordinate-wise convexity bound
$$
|(1-\lambda)F(x)+\lambda G(x)|^p\leq (1-\lambda)|F(x)|^p+\lambda |G(x)|^p.\tag{2}
$$
Integrating over $x$, we obtain
$$
\|(1-\lambda)F+\lambda G\|_p^p\leq 1\tag{3}
$$
and thus the claim follows.
Note that we would get the equality in (0) only if we get equality in (3), which implies that we have equality in (2) for almost every $x$:
$$
|(1-\lambda)F(x)+\lambda G(x)|^p= (1-\lambda)|F(x)|^p+\lambda |G(x)|^p.\tag{4}
$$
It follows from (4) that
$$
F(x)=G(x)\quad a.e.\tag{5}
$$
i.e.
$$
\frac{f(x)}{1-\lambda}=\frac{g(x)}{\lambda}\quad a.e.
$$
We are done.
To see how (4) implies (5), consider the following inequalities:
$$
|(1-\lambda)a+\lambda b|^p\leq((1-\lambda)|a|+\lambda |b|)^p
\leq (1-\lambda)|a|^p+\lambda|b|^p\tag{6}
$$
When we have $
|(1-\lambda)a+\lambda b|^p= (1-\lambda)|a|^p+\lambda|b|^p
$, (6) forces
$$
|(1-\lambda)a+\lambda b|^p=((1-\lambda)|a|+\lambda |b|)^p
=(1-\lambda)|a|^p+\lambda|b|^p.\tag{7}
$$
Since the map $x\mapsto x^p$ is strictly convex (by the positve second derivative) on $(0,\infty)$, the second equal sign in (7) implies $|a|=|b|$ and thus $a=\pm b$. By the first equal sign in (7), we must have $a=b$.
[Added:]
Note that this argument fails for $p=1$ (which was a typo in OP pointed out by a comment) since we have exploited the strict convexity of the map $x\mapsto x^p$ here. One actually has easy counterexamples for the statement when $p=1$.