Short Answer
As indicated by Cosmas Zachos in the comments this has a lot to do with the commutation relation. In short the reasons the dimensions work out is that unlike in the discrete case the rising and lowering operators in general are not dimensionless. Below I will give the mathematical detail of how the equations given in Altland and Simons generalize to the continuous case.
Long Answer
To see this consider a continuous quantity $\vec q$ which could be position, momentum etc. let the commutation relation between $a^\dagger(\vec q)
$ and $a(\vec q')$ be:
$$[a(\vec q'), a^\dagger (\vec q)]=\mathcal{C} \; \delta^d(\vec q-\vec q')$$
for some constant $\mathcal{C} $ (usually, but not always, $\mathcal{C} =1$). As stated in (Altland and Simons, 2nd ed, 2010; pg47) the second quantization of an operator $\hat A_{1p}$ in its eigenbasis:
$$\hat A=\sum_{\lambda=0}^\infty \left<\lambda \right| \hat A_{1p} \left| \lambda \right> \hat n_\lambda\tag{A1}$$
Let us look at how this generalizes to the continuous case. Here:
$$(\text{number of states $\in d^d\vec q$})=\hat a^\dagger (\vec q)\; a(\vec q) \;\frac{d^d \vec q}{\mathcal{C} }$$
this can be motiviated by acting on e.g. $a^\dagger(\vec q) \left| 0\right>$ and integrating over $d^d\vec q$ to see you get $1$. Thus we get:
$$\hat A=\int \frac{d^d \vec q}{\mathcal{C} } \left<\vec q \right| \hat A_{1p} \left| \vec q \right>\hat a^\dagger (\vec q)\; a(\vec q) $$
So this explains the presence of the form when the eigenbasis is continuous. We will now look at the case where it is discrete but we want to move to a continuous one. Our starting point is thus (A1). Here we have that:
$$\hat n_\lambda= \hat a_\lambda^\dagger \hat a_\lambda$$
The resolution of the identity for the states $\left| \vec q\right>$ is (due to the $\mathcal{C}$):
$$ I=\int \frac{d^d\vec q}{\mathcal{C}} \left|\vec q\right>\left<\vec q \right|$$
Thus performing a change of basis on $\hat n_\lambda$ we get:
$$\hat n_\lambda=\int \frac{d\vec q d\vec q'}{\mathcal{C}^2}\left<\vec q|\lambda \right>\left<\lambda|\vec q' \right>\hat a_{\vec q}^\dagger \hat a_{\vec q'}$$
Subbing this into (A1) and using that:
$$\sum_{\lambda=0}^\infty \left<\lambda \right| \hat A_{1p} \left|\lambda\right> \; \left| \lambda\right>\left<\lambda\right|=\hat A_{1p}$$
we get:
$$\hat A=\int \frac{d\vec q d\vec q'}{\mathcal{C}^2} \left<\vec q \right| \hat A_{1p} \left| \vec q' \right>\hat a^\dagger (\vec q)\; a(\vec q') $$
which is the generalized form of the equation in the question.