I have the following integral
$$I=\int D\varphi \; e^{-\int d^4p d^4p' \left[ -\frac{1}{2}\varphi(p) g(p) \delta(p+p') \varphi(p') \right]}.\tag{1}$$
This is the continuum limit of a gaussian matrix integral: $$\int d\phi_1 \cdots d\phi_N \exp^{-\sum_{i,j}^N \phi^i M_{ij}\phi^j} = \sqrt{\frac{\pi}{\det(M)}}$$
Thus I find
$$ I = C \det( g(p) \delta(p+p') )^{-1/2} = C \prod_i - (g(p_i) g(-p_i))^{-1/2} \tag{2}$$
and
$$ \frac{\delta I}{\delta g(p)} = -\frac{1}{2}g(p)^{-1} I. \tag{3}$$
Here $C$ is some (possibly diverging) constant factor. The RHS is not invariant under $p\to-p$.
On the other hand I can compute
$$ \frac{\delta I}{\delta g(p)} = \frac{1}{2}\int D\varphi \; \varphi(p)\varphi(-p) \; e^{-\int d^4p' d^4p'' \left[ -\frac{1}{2}\varphi(p') g(p') \delta(p'+p'') \varphi(p'') \right]} \tag{4}$$
which is clearly invariant under $p \to -p$. What mistake am I making?