$\newcommand{\v}{\boldsymbol}$ To make the problem easier, simply consider a smooth simply-connected domain $\Omega\subset \mathbb{R}^2$. $\overline{\Omega} = \overline{\Omega}_1\cup\overline{\Omega}_2$, $\partial\Omega_1\cap\partial\Omega_2 = \Sigma$ is an interior boundary curve. $\v{n}_i$ is the unit outward normal with respect to $\Omega_i$, $i=1,2$.
Now construct $u_1$ and $u_2$ satisfying the following problem: $$ \left\{ \begin{aligned} -\Delta u_i &= 0 &\quad \text{ in } &\Omega_i, \\ \nabla u_i \cdot \v{n}_i & = \alpha_i g &\text{ on } & \partial \Omega_i\backslash \partial \Omega, \\ u_i &= 0 &\text{ on } &\partial \Omega_i\cap \partial \Omega. \end{aligned} \right. $$ Let $\alpha_1$ and $\alpha_2$ be two constants and their sum equal to $1$. Also consider another function $u$, of which the restriction in $\Omega_i$ is $u_i$: $u|_{\Omega_i} = u_i$. Then for any test function $v\in H^1_0(\Omega)$: $$ \begin{aligned} \int_{\Omega}\nabla u\cdot \nabla v &= \sum_i \int_{\Omega_i} \nabla u\cdot \nabla v \\ &= -\sum_i \int_{\Omega_i} v \Delta u + \sum_i \int_{\partial \Omega_i} (\nabla u\cdot \v{n}_i) v \\ &= \int_{\Sigma} (\alpha_1+\alpha_2)gv = \int_{\Sigma} gv. \end{aligned} $$ Hence $\displaystyle \int_{\Omega}\nabla u\cdot \nabla v = \int_{\Sigma} gv$ is the variational problem $u$ satisfies. The three conditions in Lax-Milgram theorem are met:
$B(u,v) = \displaystyle \int_{\Omega}\nabla u\cdot \nabla v $ is continuous w.r.t. $H^1$-seminorm (equivalent to $H^1$-norm in $H^1_0(\Omega)$).
$B(\cdot,\cdot)$ is also coercive thanks to Poincare inequality for $H^1_0(\Omega)$.
$\displaystyle \int_{\Sigma} gv \leq \|g \|_{H^{-1/2}(\Sigma)}\, \|v \|_{H^{1/2}(\Sigma)} \leq c\|g \|_{H^{-1/2}(\Sigma)}\, \|v \|_{H^1(\Omega)}$ implies the right hand side is a bounded linear functional for $v\in H^1_0(\Omega)$.
Therefore, $u\in H^1_0(\Omega)$ in spite of being piecewisely defined.
Paradoxical part: now we can set a new pair of $\widetilde\alpha_1$ and $\widetilde\alpha_2$, as long as $\widetilde\alpha_1+\widetilde\alpha_2=1$. Apparently $\widetilde{u}_1$ and $\widetilde{u}_2$ will be different because the Neumann boundary conditions change. But if $\widetilde{u}$ is defined like $u$ above: $\widetilde{u}|_{\Omega_i} = \widetilde{u}_i$. $\widetilde{u}$ satisfies exactly the same variational problem with $u$. Moreover $\|\nabla(\widetilde{u} - u)\|_{L^2(\Omega)} = 0$ implies $\|\widetilde{u} - u\|_{H^1(\Omega)} = 0$ because $\widetilde{u}=u =0$ on $\partial \Omega$.
My question: where does this argument go wrong?
To make the problem even simpler, turn to the one-dimensional case: $\Omega=(-1,1)$ and $\Sigma=\{0\}$. The function $u$ must be $0$ at $\pm 1$, have prescribed one-sided derivatives at $0$, and be linear in between ($u''=0$). Now it is clear that in general $u$ is not continuous across $\Sigma$, and does not belong to $H_0^1(\Omega)$. Its distributional gradient $u'$ has a singular component on $\Sigma$ and the distributional Laplacian $\Delta u$ is even more singular than that, a distribution of order $1$. Such a function does not solve the elliptic problem that you posed.
The issue is that the equality $\int \nabla u\cdot \nabla v = \int gv$ does not qualify $u$ as a weak solution, unless $\nabla u$ is the weak (distributional) gradient of $u$. We must already know that $u$ is in some Sobolev class, in order for the integral form of the equation to be of any use. Here is an example that works in any dimension: consider the Dirichlet problem on the unit ball $B_1$ with zero boundary data: $$\Delta u=0 \text{ on }B_1, \quad u=0 \text{ on } \partial B_1\tag1$$ Let $u=\chi_{B_{1/2}}$, the characteristic function of a smaller ball. For any test function $v$ the equality $\int \nabla u\cdot \nabla v=0$ holds, because $\nabla u=0$ a.e. If $u$ were a weak solution of (1), it would contradict the uniqueness theorem for the Dirichlet problem. But it is not a solution because its pointwise gradient $\nabla u$ is rubbish; it is not a representative of the distributional gradient. Which is just another way of saying that $u$ is not a Sobolev function.