Black and Scholes (1973) argue that their option pricing formula can directly be derived from the CAPM. Apparently, this was the original approach through which Fischer Black derived the PDE, although Black and Scholes present this approach as an "alternative derivation" in their paper. To date, the CAPM derivation is not used anymore, although it has not been entirely forgotten (e.g., it is discussed here on MSE).
Looking at the CAPM derivation in the paper of Black and Scholes, the question arises of whether this derivation is actually correct? The authors use shorthand notation to describe stochastic integrals, and it seems that they make two mathematical mistakes as a result. To show this, let's follow the CAPM derivation of Black and Scholes, who consider an option with value $w_{t}$ on a stock with value $x_{t}$ (the stock follows a geometric Brownian motion with drift $\mu$ and standard deviation $\sigma$), and apply Ito's lemma to $w=f\left(x,t\right)$ to obtain: \begin{equation}\label{dw} \int_{0}^{t}dw_{s}=\int_{0}^{t}w_{1,s}dx_{s}+\int_{0}^{t}w_{2,s}ds+\frac{1}{2}\int_{0}^{t}w_{11,s}dx_{s}^{2},\tag{1} \end{equation} where Black and Scholes omit the integral signs in their paper. They conclude from this equation that the covariance of the return on the option with the return on the market is equal to $w_{1,t}$ times the covariance of the return on the stock with the return on the market. They argue that the CAPM beta of the option therefore equals: \begin{equation}\label{betaw} \beta_{w,t}=\frac{x_{t}w_{1,t}}{w_{t}}\beta_{x},\tag{2} \end{equation} where $\beta_{x}$ is the beta of the stock. However, equation (\ref{betaw}) is only correct if the covariance of $\int_{0}^{t}w_{2,s}ds+\frac{1}{2}\int_{0}^{t}w_{11,s}dx_{s}^{2}$ in equation (\ref{dw}) with the return on the market is equal to zero, which cannot be concluded since both integrals are stochastic. Equation (\ref{betaw}) therefore cannot be derived directly from the CAPM, which is the first mistake (Black and Scholes make a similar mistake elsewhere in their paper, as is discussed here on MSE).
If one sidesteps this first mistake and continues to follow the CAPM derivation of Black and Scholes, their next step is to use their definition of $\beta_{w,t}$ to write the expected returns on the stock and on the option as: \begin{align} E_{0}\int_{0}^{t}dx_{s}&=E_{0}\int_{0}^{t}x_{s}rds+E_{0}\int_{0}^{t}x_{s}a\beta_{x}ds, \label{Edx}\tag{3}\\ E_{0}\int_{0}^{t}dw_{s}&=E_{0}\int_{0}^{t}w_{s}rds+E_{0}\int_{0}^{t}x_{s}w_{1,s}a\beta_{x}ds,\label{Edw}\tag{4} \end{align} where $r$ is the risk free rate and $a$ is the market risk premium (Black and Scholes omit the integral signs). They then take expectations of equation (\ref{dw}) to obtain: \begin{equation}\label{Edw2} E_{0}\int_{0}^{t}dw_{s}=E_{0}\int_{0}^{t}w_{1,s}dx_{s}+E_{0}\int_{0}^{t}w_{2,s}ds+\frac{1}{2}E_{0}\int_{0}^{t}w_{11,s}dx_{s}^{2},\tag{5} \end{equation} although they omit the expectation operators $E_{0}$ from the right-hand side of the equation. Combining equations (\ref{Edw}) and (\ref{Edw2}), while using $E_{0}\int_{0}^{t}w_{1,s}dx_{s}=E_{0}\int_{0}^{t}w_{1,s}x_{s}\mu ds$ and the implication of equation (\ref{Edx}) that $\mu=r+a\beta_{x}$, yields after some rearranging: \begin{equation}\label{EPDE} E_{0}\int_{0}^{t}w_{2,s}ds=E_{0}\int_{0}^{t}w_{s}rds-E_{0}\int_{0}^{t}w_{1,s}x_{s}rds-\frac{1}{2}E_{0}\int_{0}^{t}w_{11,s}dx_{s}^{2}.\tag{6} \end{equation} Black and Scholes argue that this equation implies their partial differential equation: \begin{equation}\label{PDE} w_{2,t}=w_{t}r-w_{1,t}x_{t}r-\frac{1}{2}w_{11,t}x_{t}^{2}\sigma^{2},\tag{7} \end{equation} which may have seemed straightforward to them because their shorthand notation omits the integral signs and expectation operators in equation (\ref{EPDE}) and also writes $dx_{t}^{2}= x_{t}^{2}\sigma^{2}dt$ (which is incorrect, although $E_{0}\int dx_{t}^{2}=E_{0} \int x_{t}^{2}\sigma^{2}dt$). The more formal notation, however, makes clear that equation (\ref{PDE}) cannot be directly derived from equation (\ref{EPDE}), which is the second mathematical mistake.
Is there an alternative derivation of the PDE that uses the CAPM only, or do the two mistakes above imply that the PDE of Black and Scholes cannot be directly derived from the CAPM?