Let $A_i$ be a family of sets such that each $A_i$ is well-ordered. Let $\varphi(x,S,W)$ be the formula $$ \forall z ( (z,x) \in W \rightarrow z \notin S)$$ where $W$ is the well-order on $S$. Then $\varphi(x,S,W)$ is true if and only if $x$ is the $W$-minimal element of $S$.
Let's use Separation to obtain the family $A_i' = \{ x : \varphi(x,A_i,W_i) \} = \{a_i\}$ consisting of one element sets. Next let's make ordered pairs $(i,a_i)$ from these using Pairing. Finally, let's apply Union to pack these pairs into one set $F = \{(i,a_i)\}_{i\in I}$. So far we have not invoked the axiom of choice anywhere. But $F$ seems to be a function $F: I \to \{A_i\}_i$, choosing one element from each $A_i$.
Where is the flaw in my construction? As I understand it's only possible to construct a choice function for $A_i$ if not only each $A_i$ is well-ordered but $\bigcup_i A_i$ is well-ordered, too.
Thanks for your help.