The simplified integral $(*)$ can indeed be evaluated with the residue theorem.
$$\begin{align*}
I &= \int_0^\tfrac\pi2 \frac x{\cos x+\sin x} \, dx \\
&\stackrel{(*)}= \frac\pi4 \int_0^\tfrac\pi2 \frac{dx}{\cos x+\sin x} & x\to\frac\pi2-x;\text{ average}\\
&= \frac\pi4 \underbrace{\int_0^\infty \frac{dy}{(1+y)\sqrt{1+y^2}}}_{\mathcal I} & y=\tan x
\end{align*}$$
Introduce the complex function
$$f(z) = \frac{\log z}{(1+z)\sqrt{1+z^2}} = \frac{\log\lvert z\rvert+i\arg z}{(1+z)\sqrt{\left\lvert1+z^2\right\rvert}\,\exp\left(\frac i2\left[\arg(z-i)+\arg(z+i)\right]\right)}$$
to be integrated along a positively oriented circular contour $\mathcal C$, deformed to avoid branch cuts taken along the positive real axis, such that $\arg z\in(0,2\pi)$; and along the rays $\pm i[1,\infty)$, such that $\arg(z-i)\in\left(-\dfrac{3\pi}2,\dfrac\pi2\right)$ and $\arg(z+i)\in\left(-\dfrac\pi2,\dfrac{3\pi}2\right)$.

$\mathcal C$ is comprised of small arcs (radius $\varepsilon>0$) encircling the branch points at $z\in\{0,\pm i\}$, chunks of a larger arc (radius $R\gg1$), and the multiple line segments that join them, which I'll denote by $A,B,C$ if following the path is takes us away from the origin, and $A',B',C'$ if they point toward it. The integrals along the arcs vanish in their respective limits $(\varepsilon\to0,R\to\infty)$. The remaining pieces' contributions are summarized and joined below.
$$\begin{align*}
\int_A f(z)\,dz &\to \int_0^\infty \frac{\log x}{(1+x)\sqrt{1+x^2}} \, dx & z=x+i\varepsilon \\
\int_{A'} &\to \int_\infty^0 \frac{\log x+i2\pi}{(1+x)\sqrt{1+x^2}} \, dx & z=x-i\varepsilon \\
\int_B &\to \int_1^\infty \frac{\log\lvert ix\rvert+i\frac\pi2}{(1+ix)\sqrt{x^2-1}\exp\left(\frac i2\left[-\frac{3\pi}2+\frac\pi2\right]\right)} \, dx & z=-\varepsilon+ix\\
\int_{B'} &\to \int_\infty^1 \frac{\log\lvert ix\rvert+i\frac\pi2}{(1+ix)\sqrt{x^2-1}\exp\left(\frac i2\left[\frac\pi2+\frac\pi2\right]\right)} \, dx & z=\varepsilon+ix \\
\int_C &\to \int_1^\infty \frac{\log\lvert-ix\rvert+i\frac{3\pi}2}{(1-ix)\sqrt{x^2-1} \exp\left(\frac i2\left[-\frac\pi2-\frac\pi2\right]\right)} \, dx & z=\varepsilon-ix \\
\int_{C'} &\to \int_\infty^1 \frac{\log\lvert-ix\rvert+i\frac{3\pi}2}{(1-ix)\sqrt{x^2-1} \exp\left(\frac i2\left[-\frac\pi2+\frac{3\pi}2\right]\right)} \, dx & z=-\varepsilon-ix \\[2ex]
\hline
\int_{A\cup A'} &\to -i2\pi \, \mathcal I \\
\int_{B\cup B'} &\to -2 \int_1^\infty \frac{\log x+i\frac\pi2}{(1+ix)\sqrt{x^2-1}} \, dx \\
\int_{C\cup C'} &\to 2 \int_1^\infty \frac{\log x+i\frac{3\pi}2}{(1-ix)\sqrt{x^2-1}} \, dx
\end{align*}$$
There's a simple pole at $z=-1$ with residue $\dfrac{i\pi}{\sqrt2}$. By the residue theorem, and further combining the preceding log-integrals, we have
$$\oint_{\mathcal C} f(z) \, dz = -i2\pi\,\mathcal I + 4i\,J_1+i2\pi\,J_2-4\pi\,J_3 \stackrel{(\star)}= -\sqrt2\,\pi^2$$
where each of
$$\begin{align*}
J_1 &= \int_1^\infty \frac{x\log x}{\left(1+x^2\right)\sqrt{x^2-1}} \, dx \\
J_2 &= \int_1^\infty \frac{dx}{\left(1+x^2\right)\sqrt{x^2-1}} \\
J_3 &= \int_1^\infty \frac x{\left(1+x^2\right)\sqrt{x^2-1}} \, dx
\end{align*}$$
are convergent and real-valued. We can ignore $J_3$ upon taking imaginary parts of both sides of $(\star)$:
$$\mathcal I = \frac2\pi J_1 + J_2 \implies I = \frac12 J_1 + \frac\pi4 J_2$$
$J_1$ can be computed as follows. (On the other hand, perhaps there's some shortcut to establishing $I=J_1$; if there is, I don't see it yet. Follow-up question)
$$\begin{align*}
J_1 &= \int_0^\tfrac\pi2 \frac{\log(\csc y)}{1+\sin^2y}\,dy & x=\csc y \\
&= \int_0^\tfrac\pi2 \frac{\arctan\left(\sqrt2\,\tan y\right)}{\sqrt2\,\tan y} \, dy & \text{by parts} \\
&= \frac1{\sqrt2}K\left(\sqrt2\right) = \frac\pi{2\sqrt2}\log\left(1+\sqrt2\right)
\end{align*}$$
where $K(a) := \displaystyle \int_0^\tfrac\pi2 \frac{\arctan(a\tan y)}{\tan y}\,dy \implies K'(a) = \int_0^\tfrac\pi2 \frac{dy}{1+a^2\tan^2y} = \frac\pi{2(1+a)}$.
$J_2$ is elementary,
$$J_2 \stackrel{x=\csc y}= \int_0^\tfrac\pi2 \frac{\sin y}{2-\cos^2y} \, dy = \frac1{\sqrt2} \log\left(1+\sqrt2\right)$$
so we can finally conclude that $I=\boxed{\dfrac\pi{2\sqrt2}\log\left(1+\sqrt2\right)}$.