Show that a semigroup with $aS \cup \{a\} = bS \cup \{b\}$ and $Sa \cup \{a\} = Sb \cup \{b\}$ is a group

As pointed out in the comments by DerekHolt, the key is Green's Lemma (as cited in the mentioned book on page 49). To formulate it, we start with an arbitrary semigroup $S$, and we define equivalence relations $\mathcal R$ and $\mathcal L$ on $S$ by setting \begin{align*} a \mathcal R b & :\Leftrightarrow \{a\} \cup aS = \{ b \} \cup bS, \\ a \mathcal L b & :\Leftrightarrow \{a\} \cup Sa = \{ b \} \cup Sb \end{align*} for all $a, b \in S$. These are part of what is known as Green's relations. Then we have:

(Green's Lemma) If $a \ne b$ and $a \mathcal R b$ with $as = b, a = bt$, then the maps $$ x \mapsto xs \quad \mbox{and} \quad x \mapsto xt $$ are mutually inverse bijections between the $\mathcal L$-classes of $a$ and $b$, which preserve $\mathcal R$-classes. A similar (dual) relation holds if $a\mathcal L b$.

Proof: Its easy to see that $\mathcal L$ is a left congruence and $\mathcal R$ is a right congruence. Hence if $x\mathcal L a$ then $xs \mathcal L as$, so $xs \mathcal L b$ because $b = as$. Similarly, right multiplication by $t$ maps the $\mathcal L$-class of $b$ into the one of $a$. So the two maps between the $\mathcal L$-classes are well-defined. Also, if $x = ua$ then $$ xst = uast = ubt = ua = x $$ and similarly $yts = y$ for all $y \mathcal L b$; hence they are mutually inverse on the corresponding $\mathcal L$-classes. Also, as $\mathcal R$ is a right congruence, the images of $\mathcal R$-related elements stay $\mathcal R$-related, but further as $x = (xs)t$ for $x \mathcal L a$ we have $x \mathcal R xs$ and so the mapping stays in the same $\mathcal R$-class for all elements $\mathcal L$-equivalent to $a$. $\square$

The assumption of the question gives that we just have a single $\mathcal R$-class and a single $\mathcal L$-class. So pick arbitrary $a \ne b$ and $as = b$ and $a = bt$, then for every $x \in S$ by the above we have $$ xst = x $$ giving that $e := st$ is idempotent (set $x := e$ above) and a right-identity. Further as the equations $ux = e$ and $xu = e$ are solvable for each $u \in S$ it must be a group.

Remark 1: With further theory from the book it is shown that every non-empty intersection of an $\mathcal L$-class and an $\mathcal R$-class is a group.

Remark 2: In the paper Intersections of maximal ideals in semigroups by P. Grillet I found

An ideal $I$ is maximal iff $S - I$ is a $\mathcal J$-class.

And the same proof works in case of right-ideals and $\mathcal R$-classes and left-ideals and $\mathcal L$-classes. So if $aS = S \setminus \{a\}$, then as $aS$ is a right ideal it is maximal and $\{a\}$ would be a single $\mathcal R$-class, which is excluded. Hence $aS = S$ for all $a \in S$. Similar $Sa = S$ for all $a \in S$ so that $S$ is a group. And the result follows without Green's lemma.