Sub-numbering for Theorems, but the sub-theorems as separate blocks

I would like to have letters as sub-numbering for some theorems, similarly to this question, but I would like to have the two sub-theorems ''separately'', to be able to include anything between them.

I found an approach using newcounter as an answer to a slightly different question and tried to modify it to do what I want, but I cannot get it work. Here is what I tried:

\documentclass{article}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}
\newtheorem{theorem2}{Theorem}

\newcounter{pretheorem}
\counterwithin{theorem2}{pretheorem}
\renewcommand\thetheorem{\arabic{pretheorem}\alph{theorem2}}
\newcommand{\theoremgroup}{\refstepcounter{pretheorem}}

\begin{document}

\begin{theorem}
This should be Theorem 1.
\end{theorem}

\theoremgroup
\begin{theorem2}
This should be Theorem 2a.
\end{theorem2}

\begin{theorem2}
This should be Theorem 2b.
\end{theorem2}

\begin{theorem}
This should be Theorem 3.
\end{theorem}

\end{document}


By trial and error I figured out a way. It turns out Latex doesn't like if a theorem name ends on a number in this case.

\newtheorem{theorem}{Theorem}
\newtheorem{theoremgrp}{Theorem}

\newcounter{subtheorem}
\counterwithin{theoremgrp}{subtheorem}
\renewcommand\thetheoremgrp{\arabic{theorem}\alph{theoremgrp}}
\newcommand{\theoremgroup}{\refstepcounter{subtheorem}\refstepcounter{theorem}}


The usage is

\begin{theorem}
Lorem ipsum
\end{theorem}


for normal theorems with a single number, and

\theoremgroup
\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}

\begin{theoremgrp}
Lorem ipsum
\end{theoremgrp}

...


for multi-part theorems. The numbering is common, e.g. 1, 2a, 2b, 2c, 3...

I still don't know WHY this works, so any explanations are welcome!