I am recently studying Morse-Kelley set theory (MK). There is an axiom called the **axiom of class comprehension**, which states that, given a predicate $\phi(x)$ written in the language of first-order logic with the term class and $\in$, then there is a class $C = \{x: \phi(x) \land \exists y\;(x \in y) \}$. Formally,
$$
\exists C\; \forall x\; (x \in C \iff \phi(x) \land \exists y\; (x \in y)).
$$

Then, I suspect that the definition of arbitrary union of classes (not necessarily sets) can be defined as:

Given a predicate $\phi(x)$ in the context of the theory, the

unionof all classes $C$ satisfying $\phi(C)$ is defined as:$$ \bigcup_{P(C)} C := \{x: \exists C\; (\phi(C) \land x \in C)\}. $$

For the sake of convenience, let's define the predicate $P(x)$ as "$\exists C\; (\phi(C) \land x \in C)$", then, for any class $x$, we have $$ P(x) \iff P(x) \land \exists y\; (x \in y), $$ as $x \in C$ in the clause of the definition. So, by the axiom of class comprehension, this definition is valid.