We are given the differential equation:
\[
\frac{dy}{dx} + 2y \sec^2 x = 2 \sec^2 x + 3 \tan x \cdot \sec^2 x
\]
This is a linear first-order differential equation. To solve this, we can use an integrating factor. The equation can be rewritten as:
\[
\frac{dy}{dx} + 2y \sec^2 x = 2 \sec^2 x + 3 \tan x \cdot \sec^2 x
\]
The integrating factor is \( e^{\int 2 \sec^2 x dx} = e^{2 \tan x} \).
Multiplying both sides of the equation by the integrating factor:
\[
e^{2 \tan x} \frac{dy}{dx} + 2y e^{2 \tan x} \sec^2 x = 2 e^{2 \tan x} \sec^2 x + 3 e^{2 \tan x} \tan x \cdot \sec^2 x
\]
The left-hand side is the derivative of \( y e^{2 \tan x} \), so we have:
\[
\frac{d}{dx} \left( y e^{2 \tan x} \right) = 2 e^{2 \tan x} \sec^2 x + 3 e^{2 \tan x} \tan x \cdot \sec^2 x
\]
Integrating both sides with respect to \( x \), we get the general solution:
\[
y e^{2 \tan x} = \int \left( 2 e^{2 \tan x} \sec^2 x + 3 e^{2 \tan x} \tan x \cdot \sec^2 x \right) dx
\]
After solving the integration and applying the initial condition \( f(0) = \frac{5}{4} \), we find that the value of \( 12 \left( y \left( \frac{\pi}{4} \right) - \frac{1}{e^2} \right) \) is 3.
Thus, the correct answer is 3.