One should take what I'm about to describe here with a 'pinch of salt' since the derivation I have in mind is not as complete as I would have liked.
In fact, in addition to the usual textbook answers given by @Qmechanic and @Sparticle there is in fact a sense in which the path integral you have written down already contains a path integral over target space metrics, $G$: it is hidden in the sum over loops (by which I mean string loops, not $\alpha'$ loops).
In particular, if one sums string loops (under certain approximations, in particular allowing for some overcounting) one can show that even the flat spacetime path integral ends up equaling a path integral over target space fields ($G,B,\Phi$ plus massive fields):
$$
\sum_{\rm topologies} \int \mathcal{D}(X,g)\,e^{-I[X,g,G_0]}\sim \int \mathcal{D}(G,B,\Phi,\dots)\,e^{-S[G,B,\Phi,\dots]}\qquad (*)
$$
for some auxiliary metric$^1$ $G_0$ which can be taken to be $\eta_{\mu\nu}$ and $S[G,B,\Phi,\dots]$ is the non-perturbative string theory action. Of course, nobody knows what non-perturbative string theory is but in the IR $S[G,B,\Phi,\dots]$ does reduce to Einstein-Hilbert plus dilaton etc. The only published paper I know of that discusses some hints towards this underlying structure is a little-known short paper by Arkady Tseytlin. Of course it is clear from (*) that the target space metric is fully dynamical, and more importantly why it is a theory of quantum gravity in the first place.
This is also why string theory is background-independent, but this is not manifest since one has to sum loops (which is hard). Of course, this is all consistent with the textbook answers (given, e.g., by @Qmechanic and @Sparticle) because those arguments are perturbative (and usually tree level in terms of string loops, but quantum in $\alpha'$). If one includes string loops (even one loop) it is immediately apparent that loops shift the background fields -- this is the Fischler-Susskind mechanism and has been known since the 80's -- so (*) is also quite natural from this viewpoint. Incidentally, this is how it was discovered that bosonic strings naturally want to live in de Sitter (at least that's what the first loop correction gives, and ignoring the tachyon).
I should also emphasise that there are assumptions underlying the derivation of (*), e.g., it is not known whether it is possible to derive it without spoiling renormalisability. I'll leave it at this for now.
$^1$ (Ideally, the choice of metric $G_0$ would represent a global minimum of the full quantum effective action, $S[G,B,\Phi,\dots]$, but this is hard since one ends up having to untangle a path integral that is defined iteratively in terms of an infinite number of other path integrals (with offshell vertex operator insertions) -- so not what one might give their graduate student as a homework problem. Usually one does this in perturbation theory where things become tractable (if a little messy), but more often one just works with the low energy effective action. In principle nevertheless, even if one chooses a metric that does not represent such a minimum the loops will induce tadpoles whose cancellation will correct the bad choice of $G_0$. This is the sense in which flat space string theory already contains everything, at least this is my understanding.)