Another take on the question which uses stochastic calculus
[Digression]
Assume deterministic and constant rates without loss of generality. Also assume the absence of arbitrage opportunities and market completeness
Let $B_t$ denote the time-$t$ value of a risk-free money market account in which 1 unit of currency $C$ has been invested at $t=0$:
\begin{align}
& dB_t = rB_t dt,\ \ B(0)=1 \\
\iff& B_t = e^{rt}
\end{align}
Under the risk-neutral measure $\mathbb{Q}_B$ associated to the numéraire $B_t$, for any tradable asset $V_t$
$$ \frac{V_t}{B_t} \text{ is a } \mathbb{Q}_B\text{-martingale} $$
Now, assume that the stock price follows a GBM under $\mathbb{Q}_B$
\begin{align}
&\frac{dS_t}{S_t} = r dt + \sigma dW_t^{\mathbb{Q}_B},\ \ S(0)=S_0 > 0 \\
\iff& S_T = S_0 e^{(r-\frac{\sigma^2}{2})T + \sigma W_T^{\mathbb{Q}_B}}
\end{align}
Define an EMM $\mathbb{Q}_S$ which uses the stock price $S_t$ as numéraire, then for any tradable asset $V_t$
$$ \frac{V_t}{S_t} \text{ is a } \mathbb{Q}_S\text{-martingale} $$
From the 2 EMM definitions we simultaneously have
$$ \frac{V_0}{B_0} = E^{\mathbb{Q}_B}\left[\frac{V_T}{B_T} \vert \mathcal{F}_0\right] $$
$$ \frac{V_0}{S_0} = E^{\mathbb{Q}_S}\left[\frac{V_T}{S_T} \vert \mathcal{F}_0\right] $$
re-arranging we see that
$$ E^{\mathbb{Q}_B}\left[\frac{V_T B_0}{B_T} \vert \mathcal{F}_0\right] = E^{\mathbb{Q}_S}\left[\frac{V_T S_0}{S_T} \vert \mathcal{F}_0\right] (\ = V_0) $$
in other words, the Radon-Nikodym derivative of the change of measure writes:
$$ \left. \frac{d\mathbb{Q}_S}{d\mathbb{Q}_B} \right\vert \mathcal{F}_t = \frac{S_T B_0}{S_0 B_T} = e^{-\frac{\sigma^2}{2}t + \sigma W_t^{\mathbb{Q}_B}} $$
which is a Doléans-Dade exponential
$$ \left. \frac{d\mathbb{Q}_S}{d\mathbb{Q}_B} \right\vert \mathcal{F}_t = \mathcal{E}(\sigma W_t^{\mathbb{Q}_B}) $$
Using Girsanov theorem we can write that
\begin{align}
W_{t}^{\mathbb{Q}_S} &= W_{t}^{\mathbb{Q}_B} - \langle W_{t}^{\mathbb{Q}_B}, \sigma W_t^{\mathbb{Q}_B} \rangle_t \\
&= W_{t}^{\mathbb{Q}_B} - \sigma t
\end{align}
Thus the dynamics of $S_t$ under $\mathbb{Q}^S$ reads
\begin{align}
&\frac{dS_t}{S_t} = (r + \sigma^2) dt + \sigma dW_t^{\mathbb{Q}_S},\ \ S(0)=S_0 > 0
\end{align}
[Calculation]
Now, the expectation:
$$ e^{-rT} E^{\mathbb{Q}_B} \left( S_T 1_{\{S_T >K\}}\mid \mathcal{F}_0 \right) = E^{\mathbb{Q}_B} \left( \frac{S_T 1_{\{S_T >K\}} B_0}{B_T} \mid \mathcal{F}_0 \right) $$
can be written (change of measure)
$$ S_0 E^{\mathbb{Q}_S}\left(1_{\{S_T >K\}}\mid \mathcal{F}_0 \right) $$
and this expectation is easy to compute since we have shown that $S_T$ remains lognormal under $\mathbb{Q}_S$.
In fact, it is exactly the same derivation as for $E^{\mathbb{Q}_B}(1_{\{S_T >K\}}) = \mathbb{Q}_B(S_T > K) = N(d_2)$, where one just has to replace $r$ by $r+\sigma^2$, hence the definitin of $d_1$.