Below we use a few twists on the extended Euclidean algorithm and we explain in detail how lone student's slick answer is a special case of one of these (Gauss's modular inversion algorithm).
Let $\,x = \sqrt[3]5,\,$ so $\,\color{#90f}{x^3 = 5},\,$ so $\,(\color{c00}{x\!-\!a})(\underbrace{x^2\!+\!ax\!+\!a^2}_{\textstyle \color{#b70}{g_a}})=\!\color{#90f}{\underbrace{x^3}_{5}}\!\!-a^3 = \begin{cases}\ \ \ \color{#0aa}{6,\,\ a=-1}\\[.1em] \color{#b70}{-3,\,\ a\ =\ 2}\end{cases}$
${\rm so} \ \ \dfrac1{(\color{#0aa}{x^2\!-\!x\!+\!1})\!-\!2}\ {\dfrac{x\!+\!1}{\color{#0aa}{x\!+\!1}}}
=\dfrac{x\!+\!1}{\color{#0aa}6\!-\!2(x\!+\!1)}
=\dfrac{\color{0a0}{3\!+\!\color{#b70}{x\!-\!2}\!}}{-2\,(\color{#b70}{x\!-\!2})}\ \color{#b70}{\dfrac{g_2}{g_2}}= \dfrac{3g_2\!\color{#b70}{-\!3}}{-2(\color{#b70}{-3})}=\color{#c00}{\dfrac{g_2\!-\!1}{2}}$
That's the essence of lone student's proof. We show below how it is related to the more general algorithm for modular inversion by the extended Euclidean algorithm (in particular, we show how the above method is a special case of Gauss's algorithm for modular inversion).
We compute $\,\color{#c00}{f\equiv (x^2\!-\!x\!-\!1)^{-1}}\pmod{x^3\!-5}\,$ via Forward Extended Euclidean Algorithm
fractionally: $\ \ \ \ \dfrac{0}{\color{#90f}{x^3\!-5}}\overset{\large\frown}\equiv\dfrac{1}{x^2\!-\!x\!-\!1}\overset{\large\frown}\equiv\,\dfrac{\!\!-x\!-\!1}{\color{#0a0}{2x\!-\!4}}\overset{\large\frown}\equiv\color{#c00}{\dfrac{x^2\!+\!2x\!+\!3}2=\dfrac{g_2\!-\!1}2},\ $ in equation form:
$\!\!\!\begin{array}{rrl}\bmod\ \color{90f}{x^3-5}\!:\qquad\ \ [\![1]\!] &\color{#90f}{(x^3\!-5)}f&\!\!\!\equiv\, 0\\
[\![2]\!]&\!\! (x^2\!-x\!-\!1)f&\!\!\!\equiv\, 1;\ \ \ \ \ \ \ \ \ \ \color{#90f}{x^3\!-\!5} = \smash[t]{\overbrace{\color{#0aa}{(x\!+\!1)}}^{\rm quotient}(x^2\!-x\!-\!1) +\!\! \overbrace{\color{#0a0}{2x\!-\!4}}^{\rm remainder}}\to\\
[\![1]\!]\!-\!\color{#0aa}{(x\!+\!1)}[\![2]\!] = [\![3]\!] &\color{#0a0}{(2x\!-\!4)}f&\!\!\!\equiv -x\!-\!1;\ \ \ \ \ 2(x^2\!-x\!-\!1) = \color{#b70}{(x\!+\!1)}\color{#0a0}{(2x\!-\!4)}+\color{#c00}2\,\to\\
2[\![2]\!]\!-\!\color{#b70}{(x\!+\!1)}[\![3]\!] = [\![4]\!] &\color{#c00}{2\:\!f}&\!\!\!\equiv\, \color{#c00}{x^2\!+\!2x\!+\!3 = g_2\!-\!1}\\[-1em]
\rm\small quotients\qquad\!\qquad &\rm\small remainders\ \ \ \ \end{array}$
Or since $\,p = x^3\!-\!5\,$ is prime we can use Gauss's inversion algorithm, so the last step is instead
$\!\!\begin{array}{rrl}[\![1]\!]\!-\!\color{#0aa}{(x\!+\!1)}[\![2]\!] = [\![3]\!] &\ \ \ \ \,\color{#0a0}{(2x\!-\!4)}f&\!\!\!\equiv -x\!-\!1; \ \ \ \ \ 2(x^3\!-\!5) = \smash[b]{\color{#b70}{\underbrace{(x^2\!+\!2x\!+\!4)}_{\large q(x) \,=\, g_2\!\!\!\!\!\!\!\!}}}\color{#0a0}{(2x\!-\!4)}+\color{#c00}6\,\to\\[.2em]
2[\![1]\!]\ -\ \color{#b70}{q(x)}\:\![\![3]\!] = [\![4]\!] &\color{#c00}{6f}&\!\!\!\equiv \color{#c00}{3(x^2\!+\!2x\!+\!3)\!=\!3(g_2\!-\!1)}
\end{array}$
Gauss's Algorithm uses the remainder sequence $\,r_{n+1} = p\bmod r_n\,$ (vs. $\,r_{n+1} = r_{n-1}\bmod r_n\,$ in the Euclidean algorithm). Writing the above in equivalent fraction form, using $x^3\equiv 5,\,$ we get
$$f \equiv \dfrac{1}{x^2\!-\!x\!-\!1}\,\color{#0aa}{\dfrac{x\!+\!1}{x\!+\!1}}\equiv\dfrac{x\!+\!1}{4\!-\!2x} \equiv \dfrac{x\!+\!1}{4\!-\!2x}\:\!\color{#b70}{\dfrac{g_2}{g_2}}\equiv\color{#c00}{\dfrac{3(g_2\!-\!1)}{6}}\qquad $$
Our first method is exactly equivalent to that above - which is the same as lone student's answer after reducing lone's fractions $\!\bmod x^3\!-\!5$ (i.e. substitute $x^3\equiv 5)$ at every step (vs. at end). Note that the final step in lone's answer, i.e. scaling the fraction by $\,4\:\!\color{#b70}{q(x)}=\color{#08f}{(4^3\!-\!(2x)^3)/(4\!-\!2x)}\,$ is just another method of computing the final quotient $\:\!\color{#b70}{q(x)}$ when the divisor is linear $= x-a,\,$ and when $p = x^n - c.\,$ Namely, by the Polynomial Remainder Theorem we have
$$ p(x) = (x\!-\!a) q(x) + p(a) \,\Rightarrow\, \color{#b70}{q(x)} = \dfrac{p(x)-p(a)}{x-a} \left[= \color{#08f}{\dfrac{x^n-a^n}{x-a}}\ \ {\rm if}\ \ p = x^n-c\,\right]$$
Thus lone's method is a slight rearrangement of Gauss's inversion algorithm that works in the special case of inverting a quadratic $\,f\not\equiv 0\,$ modulo a prime $\ p = x^n-c.\,$ But Gauss's algorithm works more generally for any degree $f\not\equiv 0\,$ (and the extended Euclidean algorithm works more generally for coprime $p,f$ in any Euclidean domain, i.e. $p$ need not be prime - only coprime to $f)$