This is an example of a rather general phenomenon. Let $G$ be any group, and let $\mathscr{H}$ be a chain of subgroups of $G$, meaning that for any $H_0,H_1\in\mathscr{H}$, either $H_0\subseteq H_1$ or $H_1\subseteq H_0$. Then $H=\bigcup\mathscr{H}$ is a subgroup of $G$.
Certainly $H\subseteq G$. Now suppose that $h_0,h_1\in H$; to show that $H \le G$, we must show that $h_0h_1,h_0^{-1}\in H$. Since $h_0\in H$, there must be some $H_0\in\mathscr{H}$ such that $h_0\in H_0$. $H_0$ is a subgroup of $G$, so $h_0^{-1}\in H_0 \subseteq H$, as desired. Similarly, there must be some $H_1\in\mathscr{H}$ such that $h_1\in H_1$. Since $\mathscr{H}$ is a chain, either $H_0 \subseteq H_1$ or $H_1 \subseteq H_0$. Without loss of generality $H_0 \subseteq H_1$, in which case $h_0,h_1\in H_1$. But $H_1$ is a subgroup of $G$, so $h_0h_1\in H_1 \subseteq H$, and the proof that $H\le G$ is complete.
Notice that what made this work is that each of the conditions that had to be checked involved only finitely many elements of $H$. Specifically, they were closure conditions of the following form:
$\text{If }h_0,\dots,h_n \in H,\text{ then }\phi(h_0,\dots,h_n)\in H.\tag{1}$
Suppose that $S$ is any structure with the property that a subset $H$ of $S$ is a substructure iff it satisfies a list of condition of the form $(1)$. Then if $\mathscr{H}$ is a chain of substructures of $S$, and $H = \bigcup\mathscr{H}$, the same kind of argument that I used for the group $G$ will show that $H$ is a substructure of $S$:
If $h_0,\dots,h_n\in H$, there are substructures $H_0,\dots,H_n \in \mathscr{H}$ such that $h_k\in H_k$ for $k=0,\dots,n$. The $H_k$ with $k=0,\dots,n$ are linearly ordered by $\subseteq$, so one of them contains all the rest. Let that one be $H_i$. Then $h_0,\dots,h_n\in H_i$, and since $H_i$ is a substructure of $S$, it’s closed under the function $\phi$, and hence $\phi(h_0,\dots,h_n)\in H_i \subseteq H$.