Yes, this is true for any $n$, and one only needs twice as many building blocks as in the ordinary case.
I’m going to state it for not necessarily finite abelian groups. The basic observation here is that the diagonal map embeds any pair $(A,H)$ into $(A,A)\times(A/H,0)$. In view of $\prod_i(A_i,A_i)=\bigl(\prod_iA_i,\prod_iA_i\bigr)$ and $\prod_i(A_i,0)=\bigl(\prod_iA_i,0\bigr)$, this reduces the problem to the known classification of abelian groups:
Proposition: Any structure $(A,H)$ where $A$ is an abelian group and $H\le A$ is a subdirect product of such structures where
- $A$ is subdirectly irreducible (i.e., a cyclic group of prime power order, or a Prüfer $p$-group), and
- $H=A$ or $H=0$.
There is nothing special about abelian groups: the same argument applies to noncommutative groups and normal subgroups, and more generally, to arbitrary algebras and congruences. Moreover, it applies even if we have an indexed sequence of congruences, where we may additionally impose inclusion constraints between them. Let $\Delta_A=\mathrm{id}_A$ and $\nabla_A=A\times A$ denote the smallest and largest equivalence relations on $A$, respectively.
Proposition: Let $K$ be a quasivariety and $(I,\le)$ a fixed partial order. Consider structures $(A,\{\theta_i:i\in I\})$ such that
- $A\in K$,
- each $\theta_i$ is a $K$-congruence on $A$ (i.e., $A/\theta_i\in K$), and
- $i\le j\implies\theta_i\subseteq\theta_j$.
Then any such structure is a subdirect product of structures of the form $(A,\{\theta_i:i\in I\})$ where
- $A$ is relatively subdirectly irreducible in $K$, and
- either $\theta_i=\nabla_A$ for all $i\in I$, or there exists $j\in I$ such that
$$\theta_i=\begin{cases}\Delta_A,&i\le j,\\\nabla_A,&\text{otherwise.}\end{cases}$$
Proof: For any $A\in K$, let us denote $A^\varnothing=(A,\{\nabla_A:i\in I\})$, and for $j\in J$, $A^j=(A,\{\theta_i^j:i\in I\})$, where
$$\theta_i^j=\begin{cases}\Delta_A,&i\le j,\\\nabla_A,&\text{otherwise.}\end{cases}$$
Then given any structure $(A,\{\theta_i:i\in I\})$, the diagonal map embeds it (as a subdirect product) into
$$A^\varnothing\times\prod_{i\in I}(A/\theta_i)^i,$$
and since the $B^\varnothing$ and $B^i$ operators commute with products and substructures, we can write each factor as a subdirect product of $B^\varnothing$ or $B^i$ where the $B$’s are relatively subdirectly irreducible in $K$.