Edit: The calculations are right, but intermediate reasoning is not, if $n>3$. (The issue, as pointed out by @LuckyJollyMoments, is that although the sectional curvature $A$ is intrinsic to $M$, I am using the eigenvectors of the shape operator $S_{\nu}$ in the sectional curvature; this makes the quantity not intrinsic anymore. I think this is a valuable mistake to leave up, so I have striked out the incorrect portions, and slight edits are made in blue. The correct proof of the higher dimensional Theorema-Egregium, which can be found in Spivak Vol 4, is given below — also that portion is written in a self-contained manner, so one can skip directly to it).
Let’s go general to special. Suppose $(M,g)$ is a Riemannian submanifold of $(\widetilde{M},\widetilde{g})$, and let $\alpha:TM\oplus TM\to (TM)^{\perp}$ be the (vector) second fundamental form. Then, for each point $p\in M$ and linearly independent tangent vectors $x,y\in T_pM$, Gauss’ equation tells us
\begin{align}
A_p(x,y)&=\widetilde{A}_p(x,y)+\frac{\langle\alpha(x,x),\alpha(y,y)\rangle-\|\alpha(x,y)\|^2}{\|x\|^2\|y\|^2-\langle x,y\rangle^2},
\end{align}
where $A_p(x,y)$ is the sectional curvature of the tangent plane in $T_pM$ spanned by $x,y$ as measured in $(M,g)$, and $\widetilde{A}_p(x,y)$ is the sectional curvature measured by $(\widetilde{M},\widetilde{g})$. So, this equation tells you that the sectional curvature of the submanifold (which is intrinsic to the submanifold) equals the sectional curvature of the ambient manifold (intrinsic to the ambient manifold) + some stuff involving the second fundamental form (i.e extrinsic to the submanifold).
Now, suppose $\dim \widetilde{M}=n\geq 3$ and $M$ is a hypersurface. Fixing a unit normal $\nu$ for $T_pM$, we have that the shape operator/Weingarten map $S_{\nu}: T_pM\to T_pM$ is related to the second fundamental form $\alpha$ by $\alpha(x,y)=\langle S_{\nu}(x),y\rangle\nu$. With this, the above equation becomes
\begin{align}
A_p(x,y)&=\widetilde{A}_p(x,y)+\frac{\langle S_{\nu}(x),x\rangle\langle S_{\nu}(y),y\rangle-\langle S_{\nu}(x),y\rangle^2}{\|x\|^2\|y\|^2-\langle x,y\rangle^2},
\end{align}
Symmetry of $\alpha$ implies $S_{\nu}$ is self-adjoint, so by the spectral theorem, we can find an orthonormal basis of eigenvectors $\{e_1,\dots, e_{n-1}\}$ of $S_{\nu}$ for $T_pM$, say with corresponding eigenvalues $\lambda_1,\dots,\lambda_{n-1}$. Then, for each $1\leq i<j\leq n-1$, we have that
\begin{align}
A_p(e_i,e_j)&=\widetilde{A}_p(e_i,e_j)+\lambda_i\lambda_j,
\end{align}
or rearranging, $\lambda_i\lambda_j=A_p(e_i,e_j)-\widetilde{A}_p(e_i,e_j)$
. Now, multiply over all possible pairs $i,j$ such that $1\leq i<j\leq \color{blue}{n-1}$. Then, we get
\begin{align}
(\lambda_1\cdots\lambda_{n-1})^{n-2}&=\prod_{1\leq i<j\leq n-1}\left[A_p(e_i,e_j)-\widetilde{A}_p(e_i,e_j)\right].
\end{align}
On the left this is precisely $(\det S_{\nu})^{n-2}$, and on the right, we have a bunch of products of the difference in sectional curvatures. Therefore, depending on the parity of the dimension $n$ of the ambient manifold, we can solve for $\det S_{\nu}$:
\begin{align}
\begin{cases}
\det S_{\nu}=\left(\prod_{1\leq i<j\leq n-1}\left[A_p(e_i,e_j)-\widetilde{A}_p(e_i,e_j)\right]\right)^{\frac{1}{n-2}}&,\quad\text{if $n$ odd}\\
|\det S_{\nu}|= \left(\prod_{1\leq i<j\leq n-1}\left[A_p(e_i,e_j)-\widetilde{A}_p(e_i,e_j)\right]\right)^{\frac{1}{n-2}}&,\quad\text{if $n$ even}
\end{cases}
\end{align}
In particular,
- if $n\geq 3$ is odd, and the ambient space $\widetilde{M}$ is flat then its sectional curvatures all vanish, and so we have expressed $\det S_{\nu}$ completely in terms of the sectional curvatures $A$ of the submanifold (which is completely intrinsic to the submanifold), thereby proving that $\det S_{\nu}$ (which is calculated in an extrinsic fashion) actually depends only on the geometry of the submanifold. Also, reading the formula right-to-left, we see that it does not matter which orthonormal basis $\{e_1,\dots, e_{n-1}\}$ one chooses to compute the sectional curvatures; the resulting product is independent of this choice.
- if $n\geq 4$ is even, and the ambient space is flat, then it is $|\det S_{\nu}|$ which is intrinsic to the
That this sign ambiguity must be present is obvious because the choice of normal $\nu$ is only determined up to sign, so replacing $\nu$ by $-\nu$ changes $\det S_{\nu}$ to $\det S_{-\nu}=\det(-S_{\nu})=(-1)^{n-1}\det S_{\nu}$, i.e it stays the same if $n$ is odd and flips sign if $n$ is even.
Since $\det S_{\nu}$ is originally how Gauss defined his curvature, we get the result that the Gaussian curvature is intrinsic to the submanifold In particular, specializing to $n=3$ with flat ambient space, we see that there is only one term on the right:
\begin{align}
\det S_{\nu}=A_p(e_1,e_2)\equiv A_p,\tag{$*$}
\end{align}
where $A_p\in\Bbb{R}$ denotes the sectional curvature of the plane $T_pM$ (there is only one since $M$ is 2-dimensional). $\color{blue}{\textrm{This proves Gauss’ theorema Egregium for a $3$-dimensional ambient space}}$.
A completely separate result is the following: for any $(n-1)$-dimensional Riemannian manifold $(M,g)$, the scalar curvature of $(M,g)$ is equal to the sum of the distinct sectional curvatures in any orthonormal basis $\{e_1,\dots, e_{n-1}\}$ for $T_pM$:
\begin{align}
R_p&=2\sum_{1\leq i<j\leq n-1}A_p(e_i,e_j).
\end{align}
This follows just by definition of the various things, and using orthonormality. In particular, specializing to $n-1=2$-dimensional manifold $M$, there is only one term on the right, so
\begin{align}
R_p&=2A_p.\tag{$**$}
\end{align}
So, if you now combine the two situations $(*)$ and $(**)$, we get that for a Riemannian 2-manifold $M$ embedded in a flat 3-dimensional space,
\begin{align}
\det S_{\nu}&=A_p=\frac{R_p}{2}.\tag{$***$}
\end{align}
It is this equation, $(***)$, which motivates the abstract intrinsic definition of Gaussian curvature, $K$, of a Riemannian 2-manifold $(M,g)$: we define $K:=\frac{R}{2}$, where $R$ is the scalar curvature. So, with this definition, the Gaussian curvature of a Riemannian 2-manifold coincides with the single sectional curvature $A$ of $M$, and when embedded into $\Bbb{R}^3$ it coincides with $\det S_{\nu}$, the product of the principal curvatures. So, I think you’re having an issue with what’s a definition vs what’s being proved.
Corrected proof of Theorema-Egregium.
We shall give a slightly more general result than Gauss’ Theorema-Egregium. We shall start with some generalities, and then naturally discover the statement and proof.
Let $(M,g)$ be a semi-Riemannian manifold, and let $R:\bigwedge^2(TM)\to\text{End}(TM)$ be the curvature of the Levi-Civita connection. First thing’s first, $R$ is actually skew-adjoint-valued (in terms of the $(0,4)$ version of the tensor field, defined by $R(W,Z,X,Y)=\langle R(X\wedge Y)Z,W\rangle$, this is the skew-symmetry $R_{abcd}=-R_{bacd}$). Hence, there is a unique vector bundle morphism $\rho:\bigwedge^2(TM)\to \bigwedge^2(TM)$ such that for all $p\in M$ and all $x,y,\xi,\eta\in T_pM$, we have
\begin{align}
\left\langle\rho(x\wedge y), \xi\wedge \eta\right\rangle&= \left\langle R(x\wedge y)\xi,\eta\right\rangle.
\end{align}
Here, the inner product on the left is the induced one on $\bigwedge^2(TM)$ (in general if $(V,g)$ is a pseudo-inner product space then there is one on $\bigwedge^k(V)$ defined such that for all pure wedges, we have $\langle v_1\wedge\cdots\wedge v_k, w_1\wedge\cdots\wedge w_k\rangle= \det(\langle v_i,w_j\rangle)$).
Now, let $(\widetilde{M},\widetilde{g})$ be a Riemannian manifold, and $(M,g)$ a Riemannian submanifold (i.e $g=\iota^*\widetilde{g}$ in particular, and we shall denote them all as $\langle\cdot,\cdot\rangle$) —- at this stage, $M$ can have any codimension. Let their Riemann curvatures be denoted $\widetilde{R},R$. Let $\mathrm{I\!I}:TM\oplus TM\to (TM)^{\perp}$ be the vector-valued second fundamental form (you could also phrase things in terms of the shape tensor $\alpha: TM\to \mathrm{Hom}(TM,(TM)^{\perp})$, which is related by $\alpha(x):= \mathrm{I\!I}(x,\cdot)$). Then, Gauss’ equation states that for all $x,y,\xi,\eta\in TM$ over the same base point,
\begin{align}
\langle R(x\wedge y)\xi,\eta\rangle&=\langle\widetilde{R}(x\wedge y)\xi,\eta\rangle-
[\langle \mathrm{I\!I}(x,\xi), \mathrm{I\!I}(y,\eta)\rangle
-\langle \mathrm{I\!I}(x,\eta), \mathrm{I\!I}(y,\xi)\rangle].
\end{align}
In terms of the curvature endomorphisms $\widetilde{\rho}, \rho$, this can be written as
\begin{align}
\langle \rho(x\wedge y), \xi\wedge\eta\rangle&=
\langle \widetilde{\rho}(x\wedge y), \xi\wedge\eta\rangle-
[\langle \mathrm{I\!I}(x,\xi), \mathrm{I\!I}(y,\eta)\rangle
-\langle \mathrm{I\!I}(x,\eta), \mathrm{I\!I}(y,\xi)\rangle].\tag{!}
\end{align}
The equation (!) is very useful.
Now, specialize to the case of $M$ having codimension $1$ in $\widetilde{M}$, fix a unit normal $\nu\in T_pM$ and let $S_{\nu}:T_pM\to T_pM$ be the shape operator along $\nu$. Recall this is related to $\mathrm{I\!I}$ as follows: for all $x,y\in T_pM$,
\begin{align}
\mathrm{I\!I}(x,y)&=\langle S_{\nu}(x),y\rangle \nu,\quad\text{or equivalently,}\quad
\langle\mathrm{I\!I}(x,y),\nu\rangle=\langle S_{\nu}(x),y\rangle.
\end{align}
As a result, Gauss’ equation (!) can be written in terms of the shape operator as follows:
\begin{align}
\langle \rho(x\wedge y), \xi\wedge\eta\rangle&=
\langle \widetilde{\rho}(x\wedge y), \xi\wedge\eta\rangle-
[\langle S_{\nu}(x),\xi\rangle\langle S_{\nu}(y),\eta\rangle
-\langle S_{\nu}(x),\eta\rangle\langle S_{\nu}(y),\xi\rangle].\tag{!!}
\end{align}
Since $\mathrm{I\!I}$ is symmetric, it follows $S_{\nu}$ is self-adjoint, so by the spectral theorem, there is an orthonormal basis $\{e_1,\dots, e_{n-1}\}$ consisting of eigenvectors of $S_{\nu}:T_pM\to T_pM$; let $\lambda_1,\dots,\lambda_{n-1}$ be the corresponding eigenvalues. Then, (!!) applied to $x=e_i$ and $y=e_j$ with $1\leq i<j\leq n-1$ shows that
\begin{align}
\langle \rho(e_i\wedge e_j), \xi\wedge\eta\rangle&=
\langle \widetilde{\rho}(e_i\wedge e_j), \xi\wedge\eta\rangle-
\lambda_i\lambda_j[\langle e_i,\xi\rangle\langle e_j,\eta\rangle
-\langle e_i,\eta\rangle\langle e_j,\xi\rangle]\\
&= \langle \widetilde{\rho}(e_i\wedge e_j) - \lambda_i\lambda_j e_i\wedge e_j, \xi\wedge\eta\rangle.
\end{align}
Since $\xi,\eta$ are arbitrary, it follows that Gauss’ equation can be very nicely written as
\begin{align}
\rho(e_i\wedge e_j)&=\widetilde{\rho}(x_i\wedge e_j)-\lambda_i\lambda_j \,e_i\wedge e_j.\tag{!!!}
\end{align}
In particular, if the ambient space is flat, then $\widetilde{\rho}=0$, and so this computation shows that $e_i\wedge e_j$ is an eigenvector of $\rho$ with eigenvalue $-\lambda_i\lambda_j$.
Since the operator $\rho:\bigwedge^2(TM)\to \bigwedge^2(TM)$ is constructed purely from the metric $g$ (and its Levi-Civita connection and curvature $R$), it follows that its (fiberwise) eigenvalues are also intrinsic to $M$. Thus, we have shown the following:
Theorem.
With notation as above, the collection $(\lambda_i\lambda_j)_{1\leq i<j\leq n-1}$ is intrinsic to $M$.
Hence, every symmetric function $f$ of $\binom{n-1}{2}$ variables when evaluated on these eigenvalues is also intrinsic to $M$; so if you wanted to, you could define a new type of curvature $K_f$ for each such function $f$.
The most obvious thing to do is take the product of all these eigenvalues of $\rho$ (i.e compute the (fiberwise) determinant of $\rho$):
\begin{align}
\det (-\rho)=
\prod_{1\leq i<j\leq n-1}\lambda_i\lambda_j=\left(\prod_{i=1}^{n-1}\lambda_i\right)^{n-2}=(\det S_{\nu})^{n-2}.
\end{align}
Since the quantity on the left is intrinsic to $M$, so is the quantity on the right. In particular,
- if $n\geq 3$ is odd, then we can solve this to find that $\det S_{\nu}$ is intrinsic to $M$
- if $n\geq 4$ is even, then $|\det S_{\nu}|$ is intrinsic to $M$.
This case distinction is to be expected because the choice of unit normal is only unique up to sign, and we have
\begin{align}
\det(S_{-\nu})=\det(-S_{\nu})=(-1)^{n-1}\det S_{\nu},
\end{align}
and this equals $\det S_{\nu}$ if $n$ is odd, and equals $-\det S_{\nu}$ if $n$ is even. Since $K\equiv \det S_{\nu}$ is how Gauss originally defined his curvature, we see get the following result:
Higher dimensional Theorema-Egregium.
Let $M$ be a Riemannian hypersurface in a flat Riemannian manifold $\widetilde{M}$, with $n:=\dim \widetilde{M}\geq 3$. Then, the Gauss curvature, $K$, of $M$ is intrinsic to $M$ if $n$ is odd, while merely $|K|$ is intrinsic if $n$ is even.