Step 3 (and thus also 1 and 2 on reflection) stands out to me immediately as describing two different situations for the entire game.
The case where switching gives you 2A and the case where switching gives you A/2 describe 2 completely different universes, not two different actions in one.
Agreed. Step 6 is where it breaks down, because it's redefined A as being one of the two envelopes to being the halfway point between those two envelopes. Until step 6, it's describing two parallel views of the universe (depending on which envelope you first get - hence steps 4 and 5), and then mashes them together in a way that doesn't work.
Take the practical example of $100 and $200: A is either $100 or $200 depending on which envelope you receive first, so the equation is either 0.5*A + 0.5*2A, or it is 0.5*A + 0.5*(A/2). It can never be 0.5*2A + 0.5*(A/2)
Even after looking at those numbers, it still felt wrong to me. It eventually occurred to me that this was because my intuition was telling me the total should add up to A. And it doesn't; it adds up to 9/8 A. It took me a while to realize that my intuition was wrong, and that there's no reason the total should be A.
The thing that helped me reconcile this was realizing that the A in the two equations are different values; then replacing them.
(0.5⋅(0.5⋅A + 0.5⋅2.A)) + (0.5⋅(0.5⋅A + 0.5⋅0.5⋅A)) = 9/8 A
^ but the A in the left grouping (where it's 100) is different than the A in the right grouping (where it's 200).
The case where switching gives you 2A and the case where switching gives you A/2 describe 2 completely different universes, not two different actions in one.