Partial integration, the factor $x^2\arctan x$ has a primitive function, that leads to the solution. So for short, let
$$
F(x) = \frac 13x^3\arctan x -\frac 16x^2+\frac 16\log(1+x^2)\ ,
\qquad
F'(x)=x^2\arctan x\ .
$$
Then
$$
\begin{aligned}
I &=
\int_0^{\pi / 4}\frac{x\; \tan^2 x\; \ln\tan x}{\cos^2 x}\,dx
\\
&=
\int_0^1 x^2\; \arctan x \; \ln x\,dx
\\
&=
\int_0^1 F'(x) \; \ln x\,dx
\\
&=
\lim_{a\searrow 0}\int_a^1 F'(x) \; \ln x\,dx
\\
&=
\lim_{a\searrow 0}\Big[\ F(x)\; \ln x\ \Big]_a^1
-
\lim_{a\searrow 0}\int_a^1 F(x) \; \frac 1x\,dx
\\
&=
0-\underbrace{\lim_{a\searrow 0}\frac 16\ln(1+a^2)\ln a}_{=0\text{ e.g. l'Hospital
for }\frac{\ln(1+a^2)}{1/\ln a}}
\\
&\qquad-
\lim_{a\searrow 0}\int_a^1 \left(
\frac 13x^2\arctan x -\frac 16x+\frac 16\ln(1+x^2)\;\frac 1x
\right)
\,dx
\\
&=
\lim_{a\searrow 0}
\int_a^1
\frac 16\frac {\log(1+x^2)}x\; dx
-\frac 13\Big[\ F\ \Big]_0^1
-\frac 16\Big[\ \frac 12x^2\ \Big]_0^1
\\
&=
\frac 16\int_0^1\frac {\log(1+x^2)}x\; dx
-\frac 13F(1)+\frac 1{12}\ .
\\
&=
\frac 16\cdot\frac 12\cdot\frac {\pi^2}{12}
-\frac 13F(1)+\frac 1{12}\ .
\end{aligned}
$$
The remained integral is after the substitution $y=x^2$ traced back to a dilogarithm value,
$$
J=
\int_0^1\frac {\log(1+x^2)}x\; dx
=
\frac 12\int_0^1\frac {\log(1+x^2)}{x^2}\; d(x^2)
=
\frac 12\int_0^1\frac {\log(1+y)}{y}\; dy
=
-\frac 12\int_0^{-1}\frac {\log(1-y)}{y}\; dy
=:-\frac 12\operatorname{dilog}(-1)
=\frac 12\cdot\frac{\pi^2}{12}\ .
$$
Computer check, here sage:
sage: f = lambda x: x * tan(x)^2 * log(tan(x)) / cos(x)^2
sage: g = lambda x: x^2 * arctan(x) * log(x)
sage: F(x) = integral( x^2*arctan(x), x )
sage: numerical_integral( f, (0, pi/4) )[0]
-0.055424669860611314
sage: numerical_integral( g, (0, 1) )[0]
-0.055424669860610586
sage: F(x)
1/3*x^3*arctan(x) - 1/6*x^2 + 1/6*log(x^2 + 1)
sage: F(1)
1/12*pi + 1/6*log(2) - 1/6
sage: -pi^2/6/2/12 - F(1)/3 + 1/12
-1/36*pi - 1/144*pi^2 - 1/18*log(2) + 5/36
sage: _.n()
-0.0554246698606118
sage: integral( log(1+x^2)/x, x, 0, 1 ).n()
0.411233516712057
sage: dilog(-1)
-1/12*pi^2
sage: -1/2*dilog(-1).n()
0.411233516712057
Thanks a lot for the help Zacky!