Here is an "expected utility maximization/ game theoretic" approach to the matter (with a dash of set-theoretic probability). In such a framework, the answers appear clear.
PREMISES
We are told in absolute honesty that, for $x$ a strictly positive monetary amount, the following two tickets were placed in a box : $\{A=x, B= 2x\}$ with assigned identification number $1$ and $\{A=2x, B= x\}$ with assigned identification number $0$. Then a draw from a Bernoulli $(p=0.5)$ random variable was executed, and based on the result and the event that has occurred, the amounts $x$ and $2x$ were placed in envelopes $A$ and $B$. We are not told what the value of $x$ is, or what amount went to which envelope.
First CASE: Choose an envelope with the option to switch without opening it
The first issue is how do we choose an envelope? This has to do with preferences. So assume that we are expected utility maximizers, with utility function $u()$.
We can model the probabilistic structure here by considering two dichotomous random variables, $A$ and $B$ representing the envelopes, and the amount in them. The support of each is $\{x, 2x\}$. But they are not independent. So we have to start with the joint distribution. In table form, the joint distribution, and the corresponding marginal distributions are
\begin{array}{| r | r | }
\hline
\text{A} \;/ \;\;\text{B} \rightarrow & x & 2x & \text {Marg A} \\
\hline
\hline
x & 0 & 0.5 & 0.5\\
\hline
2x & 0.5 & 0 & 0.5 \\
\hline
\text{Marg B} & 0.5 & 0.5 & 1.00 \\
\hline
\end{array}
This tells us that $A$ and $B$ have identical marginal distributions.
But this means that it doesn't matter how we choose envelopes, because we will always get the same expected utility,
$$0.5 \cdot u(x) + 0.5\cdot u(2x)$$
What we are facing here is a compound gamble (how to choose an envelope) over two identical gambles (each envelope). We can choose $A$ with probability $1$, $0$, or anything in-between (and complementarily for $B$). It doesn't matter. We will always get the same expected utility. Note that our attitude towards risk doesn't play a role here.
So we do choose an envelope, say $A$, and we are looking at it. What is now our expected utility? Exactly the same as prior to choosing. Picking an envelope in whatever way, does not affect the probabilities of what's inside.
We are allowed to switch. Say we do, and now we are holding envelope $B$. What is now are expected utility? Exactly the same as before.
These are the two possible states of the world for us: choose $A$ or choose $B$. Under any choice, both states of the world imply the same value to our chosen/assumed driving force (i.e. maximize expected utility).
So here, we are indifferent to switching., and in fact we could also randomize.
2nd CASE: OPENING THE ENVELOPE with the option to switch after
Assume now that we have picked $A$, opened it, and found inside the amount $y \in \{x, 2x\}$. Does this change things?
Let's see. I wonder, what is
$$P(A = x \mid A \in \{x, 2x\}) = ?$$
Well, $\{x, 2x\}$ is the sample space on which random variable $A$ is defined. Conditioning on the whole sample space, i.e. on the trivial sigma-algebra, does not affect neither the probabilities, nor the expected values. It is as though we wonder "what is the value of $A$ if we know that all possible values may have been realized?" No effective knowledge has been gained, so we are still at the original probabilistic structure.
But I also wonder, what is
$$P(B = x \mid A \in \{x, 2x\}) = ?$$
The conditioning statement, properly viewed as a sigma-algebra generated by the event $\big \{A \in \{x, 2x\}\big\}$, is the whole product sample space on which the random vector $(A,B)$ has been defined. From the table of the joint distribution above, we can see that the probability allocation of the joint is equivalent a.s to the probability allocation of the marginals (the "almost surely" qualification due to the presence of two events of measure zero). So here too we essentially condition the probabilities for $B$ on its whole sample space. It follows that our action to open the envelope did not affect the probabilistic structure for $B$ also.
Enter game theory, alongside decision making. We have opened the envelope, and we have to decide whether we will switch or not. If we don't switch we get utility $u(y)$. If we switch, then we are in the following two possible states of the world
$$y = x, u(A) = u(x) \implies u(B) = u(2x)$$
$$y = 2x, u(A) = u(2x)\implies u(B) = u(x)$$
We do not know which state actually holds, but per the above discussion, we do know that each has probability $p=0.5$ of existing.
We can model this as a game where our opponent is "nature" and where we know that nature plays with certainty a randomized strategy: with $p=0.5$ $y=x$ and with $p=0.5$, $y=2x$. But we also now that if we do not switch, our payoff is certain. So here is our game in normal form, with our payoffs:
\begin{array}{| r | r | }
\hline
\text{We} \;/ \;\;\text{nature} \rightarrow &y= x & y=2x \\
\hline
\text{Switch} & u(2x) & u(x) \\
\hline
\text{Don't Switch} & u(y) & u(y) \\
\hline
\end{array}
We should resist the temptation to substitute $u(x)$ and $u(2x)$ for $u(y)$. $u(y)$ is a known and certain payoff. The payoffs for the "Switch" strategy are not actually known (since we do not know the value of $x$). So we should reverse the substitution. If $y=x$ then $u(2x) = u(2y)$, and if $y=2x$ then $u(x) = u(y/2)$. So here is our game again:
\begin{array}{| r | r | }
\hline
\text{We} \;/ \;\;\text{nature} \rightarrow &y= x & y=2x \\
\hline
\text{Switch} & u(2y) & u(y/2) \\
\hline
\text{Don't Switch} & u(y) & u(y) \\
\hline
\end{array}
Now all the payoffs in the matrix are known. Is there a pure dominant strategy?
The expected payoff of strategy "Switch" is
$$E(V_S) = 0.5\cdot u(2y) + 0.5 \cdot u(y/2)$$
The expected payoff of strategy "Don't Switch" is
$$E(V_{DS}) = u(y)$$
We should switch if
$$E(V_S) > E(V_{DS}) \implies 0.5\cdot u(2y) + 0.5 \cdot u(y/2) > u(y)$$
And now, attitude towards risk becomes critical. It is not difficult to deduce that under risk-taking and risk neutral behavior, we should Switch.
As regards risk-averse behavior, I find an elegant result:
For "less concave" (strictly above) utility functions than logarithmic (say, square root), then we should still Switch.
For logarithmic utility $u(y) = \ln y$, we are indifferent between switching or not.
For "more concave" than (strictly below) logarithmic utility functions, we should not Switch.
I close with the diagram of the logarithmic case
Assume $y=4$. Then $y/2 =2, 2y = 8$. The line $Γ-Δ-Ε$ is the line on which the expected utility from "Switch" will lie. Since nature plays a $50-50$ strategy, it will actually be at point $\Delta$, which is the middle point of $Γ-Δ-Ε$. At that point with logarithmic utility, we get exactly the same utility from "Don't Switch", i.e. $\ln(4)$ for this numerical example.