Yes, this has been studied intensively for quite a while. In particular, people who work in gauge theory (as applied to 4-manifolds) have studied the effect of surgeries on the solutions to the ASD Yang-Mills equations and Seiberg-Witten equations using essentially analytic techniques. An early result of this kind by Donaldson shows that taking connected sum with ${\mathbb C}P^2$ (with its standard complex orientation) can change the number of solutions (counted with signs) from something non-zero to $0$. In other words, the moduli space (as an oriented $0$-manifold) can change under a simple topological operation on the manifold.

There is a vast literature on the subject, where one can detect much more subtle changes in the smooth topology of $4$-manifolds. You might look up the Fintushel-Stern knot surgery formula. There are also many results in other contexts such as moduli spaces of holomorphic curves.

Of course the most basic example is perhaps what you were alluding to in 2D. The dimension of the linear equations for harmonic forms (aka homology groups, by Hodge theory) depend on the topology of the underlying manifold.