It's worth mentioning that the conditions needed for $f(X_0, X_1)$ to be uniformly random based off the distributions of $X_0, X_1$ are quite mild usually.
In particular what you need is:
- $X_0$ and $X_1$ to be independent
- At least one of $X_0, X_1$ to be uniformly random (say that it is $X_0$)
- $f(\cdot, X_1) : G\to G$ to be a bijection [1] for each choice of $X_1$ (where $X_1$ is the potentially non-uniform random variable).
Then $f(X_0, X_1)$ will be uniformly distributed. The proof is fairly easy, so I'll include a sketch of it below:
- Start by looking at $\Pr_{(X_0, X_1)}[f(X_0, X_1) = k]$ for $k\in G$
- Rewrite this as $\sum_{g\in G}\Pr_{(X_0, X_1)}[f(X_0, X_1) = k\mid X_1 = g]\Pr_{X_1}[X_1 = g]$
- Use independence to write $\Pr_{(X_0, X_1)}[f(X_0, X_1) = k\mid X_1 = g] = \Pr_{X_0}[f(X_0, g) = k]$
- Use that bijections "preserve" the property of being uniformly random (so $f(X_0, g)$ is uniformly random, meaning $\Pr_{X_0}[f(X_0, g) = k] = 1/|G|$)
- Collect all of the relevant terms and simplify to show that $\Pr_{(X_0, X_1)}[f(X_0, X_1) = k] = 1/|G|$
A common source of bijections of the desired form are group operations. In particular, if $g\in G$ is a fixed group element, then the operation $x\mapsto x + g$ (where $+$ is the group operation in an arbitrary group) will always be a bijection. This includes when the fixed group element is the "inverse" of another element, meaning the function $x \mapsto x + (-g)$, which is your situation.
The above also includes the "obvious" caveat that $|G| < \infty$ for the uniform distribution to even make sense. One can work with larger groups by using the "Haar measure" rather than the "Uniform distribution", but given that you cannot even store arbitrary elements of such groups this is not a useful point for cryptography.
As for the question of what happens when we relax the algebraic conditions on the sample space, you may note that the way I formulated it above actually requires no assumptions of a group structure on $G$. It may be the case that the family of bijections $\{f(\cdot, g)\}_{g\in G}$ itself gives $G$ a group structure (the composition of two bijections is a bijection, bijections can be inverted, etc), although more properly I expect this would only show that $G$ is a subset (which may not be a subgroup!) of some group, where the group structure may be non-obvious or "complicated".
[1] One can weaken this further if $f(\cdot X_1) : G_1\to G_2$. The property that you need from a bijection is that it is a "regular" map, in the sense that there exists some constant $c\in\mathbb{N}$ such that $\forall g\in G_2$, $|f^{-1}(g)| = c$ (so all preimages are the same size). Bijections are an easy source of this (where $c = 1$), but other such maps exist (say $f : \mathbb{Z}_4\to \mathbb{Z}_2$ given by $x\mapsto x\bmod 2$, where $c = 2$).