Any rank $n$ real vector bundle $E\to X$, $X$ compact $CW$-complex is $\newcommand{\bZ}{\mathbb{Z}}$ is $\bZ/2$-oriented and, as such it has a $\bZ/2$-Thom class $\tau_E\in H^n_{cpt}(E,\bZ/2)$. Then $$w_n(E)=\zeta^*\tau_E\in H^n(X,\bZ/2),$$ where $\zeta:X\to E$ is the zero-section
Any complex vector bundle $E\to X$, $X$ compact $CW$-complex of complex rank $n$ is $\bZ$-oriented and, as such it has a $\bZ$-Thom class $\tau_E\in H^{2n}_{cpt}(E,\bZ)$. (Note that $2n$ is the real rank of $E$.) Then $$c_n(E)=\zeta^*\tau_E\in H^{2n}(X,\bZ).$$
Thus in both cases the top Stieffel-Whitney class and the top Chern class are Euler classes, with different choices of coefficients. $\newcommand{\bR}{\mathbb{R}}$ $\newcommand{\bC}{\mathbb{C}}$ $\newcommand{\bP}{\mathbb{P}}$
To get the rest of the Stieffel-Whitney/Chern classes on then needs to rely on some basic facts $$ H^\bullet(\bR\bP^n,\bZ/2)\cong\bZ/2[w]/(w^n+1),\;\; H^\bullet(\bC\bP^n,\bZ)\cong\bZ[c]/(c^n+1),\tag{1} $$ where $w\in H^1(\bR\bP^n,\bZ/2)$, $c\in H^2(\bC\bP^n,\bZ)$ are the Euler classes of the (duals) of the tautological line bundles.
These results suffice to construct the Stieffel-Whitney/Chern classes. This is the approach pioneered by Gronthendieck for the construction of Chern classes. For details see Chapter 5 of these notes.. As explained in Example 4.3.5. of these notes duality, under the guise of Thom isomorphism is also responsible for the isomorphisms (1).
One could claim that duality or Thom isomorphism is what makes things work. What is behind Thom isomorphism? As described in Bott-Tu, this follows from two basic facts about cohomology. The first is the Poincare lemma with compact supports $$H^k_{cpt}(\bR^n, G)=\begin{cases} 0, & k\neq n,\\ G, &k=n. \end{cases} $$ and the second is the MayeMayer-Vietoris principle which, roughly specking says that one can recover the cohomology of an union from the cohomology of its parts. View this as a local-to-global principle, a way a patching local data to obtain global information. The orientability condition is the one that allows the local-to-global transition.