How does GR determine the topology of spacetime? [duplicate]

This question already has an answer here:

The crux of GR is the action

$$S=\int _\mathcal M d^n x \sqrt{|g|}\,R$$

Varying this and setting $\delta S=0$ gives you the Einstein field equations. However, that only determines the metric, not the manifold, and a metric doesn't uniquely determine a manifold. For instance,

$$ds^2 = du^2 + dv^2$$

can be the metric of flat 2D space or the metric of a 2D cylinder of radius 1.

It seems that the manifold isn't determined by GR. In particular, you have an indeterminate topology—you don't if the manifold is open, closed, etc. This is problematic because if your manifold has a boundary, the action is modified to include a boundary term:

$$S=\int _\mathcal M d^n x \sqrt{|g|}\,R + \frac{1}{2} \int_{\partial \mathcal M} d^{n-1}x \sqrt{|h|}\,K$$

where $h$ is the induced metric on the boundary and $K$ the extrinsic curvature.

Does that mean you have to know the topology of the universe before you start doing any physics? Shouldn't there be "equations" of motion to determine the topology, just like there are for the metric?