As in the book that states:
We can now verify that the ordered pairs $(x, y)$, where $x \in X$ and $y \in Y$ , really do form a set, namely $$X \times Y := \left\{ p\in\mathcal{P}\left(\mathcal{P}\left(X\right)\cup\mathcal{P}\left(Y\right)\right)\mid\left(p=\left(x,y\right)\wedge\left(x\in X\right)\wedge\left(y\in Y\right)\right)\right\} $$
I think it's wrong that $p \in \mathcal{P}\left(\mathcal{P}\left(X\right)\cup\mathcal{P}\left(Y\right)\right)$, by verifying with simple example and as I read other book (T. Jech's), which states that $p\in\mathcal{P}\left(\mathcal{P}\left(X\cup Y\right)\right)$.
You are right in thinking that something is awry.
The set $\mathcal{P}(\mathcal{P}(X) \cup \mathcal{P}(Y))$ is the set of sets $F$ such that each element $A \in F$ is either a subset of $X$ or a subset of $Y$.
Given $x \in X$ and $y \in Y$, if we encode $p=(x,y)$ as $p = \{\{x,x\},\{x,y\}\}$, then the pair $\{x,y\}$ might not be a subset of $X$ or a subset of $Y$, for example if $X$ and $Y$ are both inhabited and are disjoint. Hence in general we do not have $p \in \mathcal{P}(\mathcal{P}(X) \cup \mathcal{P}(Y))$.
However, it is the case that $p \in \mathcal{P}(\mathcal{P}(X \cup Y))$, since each element of $p$ is a subset of $X \cup Y$.