Hi Paul,
In fact both results are correct. By not perturbing the Lagrangian of matter, you assume implicitely that H^2+2H'=0.
If you consider the lagrangian of a Scalar Field for instance, then there is a term coming from the variation of the determinant of the metric times the Lagrangian. So this gives an extra E_ij E^ij P, where P is the pressure of the field.
Then the identity you should use is then something like H^2+2H'+P=0, and again the extra term disappears.
Another solution is to consider a parameterzation of the perturbation of the form Exp[E_ij]. That way since E_ij is traceless, this perturbation conserves the determinant of the metric, and you never have to care about the Lagrangian of matter. This is what has been done by Jonghee Kang.
I attach a version of his notebook which does that.
The advantage on top of that is that the integrations by parts on the perturbed action are not even needed with this parameterization.
Best,
Cyril