I'm trying to rigorously describe an object that I'm calling a "portal". The situation is easiest to describe in two dimension.
I start with a line segment $pq$ in $\mathbb{R}^2$. I want to remove the relative interior of $pq$ from $\mathbb{R}^2$, pull apart the opening and consider the new "boundary" which I will denote by an oriented path $\overrightarrow{pq}$ and $\overrightarrow{qp}$. Along each of $\overrightarrow{pq}$ and $\overrightarrow{qp}$ I want to glue a copy of $\mathbb{R}^2$. The result will be the original $\mathbb{R}^2$ with two additional $\mathbb{R}^2$ glued along $\overrightarrow{pq}$ and $\overrightarrow{qp}$. However, here's the catch, I want $pq$ to act as a "portal" meaning that if I consider a path entering from $\overrightarrow{pq}$ I enter the copy of $\mathbb{R}^2$ that I glued along $\overrightarrow{pq}$ and I can only get back to the original $\mathbb{R}^2$ via that same entrance. Likewise, if I consider a path that enters along $\overrightarrow{qp}$ I should enter the copy of $\mathbb{R}^2$ that I glued along that boundary.
In $\mathbb{R}^2$ I have a smooth orientable patch of surface $\sigma$. (homeomorphic to a closed disc) that I want to behave as a portal. Each side of $\sigma$ should be glued to a different copy of $\mathbb{R}^3$ that is only accessible by a path that intersects $\sigma$ from that side.
I've thought about how to construct such a space with quotient spaces, but the intuition of a quotient space doesn't seem quite right. I've also considered gluing along the limit points of Cauchy sequences that come at $pq$ from a particular side, but that seems difficult to formalize. How would one go about formalizing this type of construction?
Replace the line between p and q by two lines, say L_1 and L_2. Label the two halves of the plane, either side of pq, the 1-side and 2-side. Call this set X_0 and define a metric on it as follows.
If the straight line between a and b passes between p and q, then d(a,b) is the smaller of the lengths ap+pb or aq+qb.
If a is on L_1, then
d(a,b) = the usual distance if b is on the 1-side
and if a is on L_2, then
d(a,b) = the usual distance if b is on the 2-side
Otherwise d(a, b) is the usual distance.
Now let X_1 and X_2 be copies of R^2 and identify each L_i with the line pq in X_i. Let X = X_0 U X_1 U X_2 and extend the metrics over X in the obvious way.
Topologically X_0 is just R^2 with an open disc removed, but this way preserves more of the metric or geometric structure.
I am not allowed to comment so I'll add this here.
I've just found the discussion of the same question on MO. As far as I can see, the approach there can't work, If you do not split/duplicate your portal P in some way, any point in P will be pathwise-connected to both sides and to all the copies and so a path entering from either side can go either way, or even stay in the original space.
Although my construction fits your stated requirements I suspect it does not do what you really want. Although a path from the original space that crosses the portal enters the other spaces depending on which side it comes from, it cannot do so as a "straight line". Moreover a path coming back out of the other space can cross over or stay in that space: locally we have a half-plane meeting a full plane. I would suggest that each space should have the same split along the line and then each side of a portal identified with only one side of a portal in another copy. (The original construction effectively links both side of a portal in a copy to one side in the original space.) The result is now locally Euclidean except at p and q. If you just have the three planes, then the spare sides in the other two will be linked to each other. If you pass through the portal from side 1 you come out of side 2 in a copy. If you then go round and through side 1 in that copy you come out from side 2 in the other copy. Go round again and in side 1 there and you come out from side 2 in the original. Of course you can add more copies and construct a more complicated network of portals. The whole construction generalises easily to higher dimensions.