Added: Trying again with $A$ and $B$ switched, but still having trouble:
The Bijection: Let $A$ be the set of bit strings of length $2n$ with the same number of $0$'s and $1$'s, and let $B$ be the set of bit strings of length $2n$ with no prefix with the same number of $0$'s and $1$'s. We construct $f:A\to B$ and $g:B\to A$ as follows. Given a string $s\in B$
Let $n=3$ and $s=111001$. The string $s$ has length $2n$ and no prefix has the same number of $0$’s and $1$’s, so $s\in B$.
Let $a_k$ be the number of $1$'s in the prefix of $s$ of length $k$,
$b_k$ the number of $0$'s, and $c_k=a_k−b_k$.
Then
$c_1=1-0=1$, $c_2=2-0=2$, $c_3=3-0=3$,
$c_4=3-1=2$, $c_5=3-2=1$, $c_6=4-2=2$.
For each $i$, let $m_i$ be the largest $k$ such that $|c_k|=i$.
Then $m_1=5$, $m_2=6$, and $m_3=3$.
Let $s'$ be the string obtained from $s$ by flipping all bits after
$m_1$, then flipping all bits after $m_2$, etc. Put $g(s)=s'$.
Starting with $s=111001$, flip all bits after $m_1=5$ to get $111000$. Now flip all bits after $m_2=6$, which flips no bits, leaving $111000$. Now flip all bits after $m_3=3$, to yield $111111$, so $g(s)=s'=111111$.
But $s'\notin A$, because it doesn’t have three of each digit.
(First version of this, after which Wade modified his answer.)
@WadeHann-Caruthers I’m confused about your answer. Can you tell me where I’m going wrong in trying to understand it?
The Bijection: Let $A$ be the set of bit strings of length $2n$ with the same number of $0$'s and $1$'s, and let $B$ be the set of bit strings of length $2n$ with no prefix with the same number of $0$'s and $1$'s. We construct $f:A\to B$ and $g:B\to A$ as follows. Given a string $s\in A$
Let $n=3$ and $s=101010$. The string $s$ has length $2n$ and the same number of $0$’s and $1$’s
Let $a_k$ be the number of $1$'s in the prefix of $s$ of length $k$,
$b_k$ the number of $0$'s, and $c_k=a_k−b_k$.
Then
$c_1=1-0=1$, $c_2=1-1=0$, $c_3=2-1=1$,
$c_4=2-2=0$, $c_5=3-2=1$, $c_6=3-3=0$.
For each $i$, let $m_i$ be the largest $k$ such that $|c_k|=i$.
Then $m_1=5$, and no other $m_i$ are defined ($m_0$ is not needed later).
Let $s'$ be the string obtained from $s$ by flipping all bits after
$m_1$, then flipping all bits after $m_2$, etc. Put $f(s)=s'$.
There is no $m_2$ or later, so flip the bits “after $5$.” If this means after position $5$, then $s'=101011$.
But $s'\notin B$, as it has the prefix $10$, with one zero and one one.