Yes, it is theoretically possible that a university accepts a thesis that has been used to acquire another degree (I even know cases where this happened for two different fields). Usually, the only way to find out is to ask the responsible people at your home university and your exchange university. The latter matters because it might cause trouble if they have some regulations about you “reusing” your thesis. I can imagine that some universities have existing regulations for this matter, so you might check them first to avoid annoying people by asking something that you could have looked up easily.
If this is not possible, I can think of some factors to consider as to which university’s degree you want to get:
- One university’s degree might have a generally higher prestige.
- Relatedly, a foreign degree might not be accepted or be less valued by potential future employers (be they academic or not). This might even hold, if there are international regulations to make degrees comparable (I know somebody who did a second thesis partly due to this).
- Finishing the degree at a foreign university while not completing the degree you originally set out to achieve might be regarded as unfinished studies by some bureaucrats, which is more likely to be negative than positve. Even worse, this may ring title-mill alerts to some. And yes, this would all be rather silly but unfortunately very real.
So, if this is any realistic, make as much decisions about your future as possible and ask potential employers as to whether they have any preference regarding this.