Is this a topological $\mathbb Z_2$ (Majorana-)invariant in *any* dimension?

Consider a non-interacting superconducting Hamiltonian in an arbitrary dimension. This is most conveniently expressed in terms of Majorana modes, which are defined as $$\gamma_{2n-1} = c_n + c_n^\dagger \quad \textrm{ and } \quad\gamma_{2n} = -i \left( c_n - i c_n^\dagger \right)$$ for every complex fermionic mode $c_n$. For convenience we label $n = 1, 2, \cdots N$ where $N$ is our number of sites, but I am not presuming a one-dimensional structure (i.e. I do not enforce a notion of locality with respect to this labeling). A generic Hamiltonian is then written as $$H = i \sum_{n,m} \gamma_n A_{nm} \gamma_m$$ where $A \in \mathbb R^{2N}\times \mathbb R^{2N}$ is anti-symmetric: $A^T = - A$.

Requiring a gap above the ground state is equivalent to demanding that $\det A\neq 0$. (Indeed: the positive eigenvalues of $A$ tell us the single-particle excitation energies.) But in that case the sign of the Pfaffian of $A$ is a well-defined quantity (i.e. $\frac{\textrm{pf} A}{\sqrt{\det A}}$).

This seemingly gives a topological $\mathbb Z_2$ invariant, independent of dimensionality! But this must be wrong, since the classification of non-interacting topological insulators/superconductors tells us this class of Hamiltonians (class D') only has a $\mathbb Z_2$ invariant when the dimension of space is $d = 1 \mod 8$.

As Kitaev (cf. equation (19) of his seminal paper) pointed out, the above $\mathbb Z_2$ invariant in fact simply equals the fermionic parity (= parity of the number of fermions) of the ground state, i.e. $P|\psi\rangle = \pm |\psi\rangle$. This is consistent with what we know of the Kitaev/Majorana chain: with closed boundary conditions, the fermionic parity of the ground state is $-1$.
This makes it clear that the above $\mathbb Z_2$ invariant is indeed well-defined in any dimension! The only way out must be: in e.g. dimensions $d=3,4,5,7$ (for which the D class' only has a trivial phase according to the classification table, cf Table 3 of the paper by Ryu et al.) it must be impossible to write down a Hamiltonian for which the ground state has an odd number of fermions. (There would have to be some conditions on this to make it precise: e.g. 'for an even number of sites', 'with a well-defined thermodynamic limit', ...)
In summary: the $\mathbb Z_2$ invariant is indeed well-defined, but one cannot always find an example which realizes a non-trival value.