As stated on Wikipedia, the formal definition of the Axiom of Extensionality is
$$\forall A \forall B(\forall X(X \in A \iff X\in B) \implies A=B)$$
Which left me underwhelmed, as it seemed more of a longhand for equality rather than an axiom. I then continued reading and saw that I fell into the category of people that
[...] treat the above statement not as an axiom but as a definition of equality
Hence the axiom of extensionality is rewritten to
$$\forall A \forall B(\forall X(X \in A \iff X\in B) \implies \forall Y(A \in Y \iff B\in Y))$$
I.e; if $A$ and $B$ conatin the same elements, then they belong to the same sets.
My question is, without that axiom, is it even possible to construct two sets that are identical in what they contain, but aren't in all the same sets?
Here's my thought process: Suppose $A$ and $B$ contain the same elements.
By the Axiom Schema of Specification, for some subset $S\subseteq T$, such that $\forall x[x \in T \iff (x \in S \wedge \phi(x))]$, such that $\phi(x)$ is entirely determined by what is contained in $x$, then $(A\in S)\iff (B\in S)$.
However if $\phi(x)$ is not entirely determined by what is contained in $x$, i.e; it's dependent on if $x$ is contained within another set, then it may not immediately be the case that $(A\in S)\iff (B\in S)$. But if those sets (that $\phi(x)$ depends on $x$ being contained within) were constructed by some $\phi_2(y)$ which is entirely determined by what is contained in $y$, then $(A\in S)\iff (B\in S)$ holds.
I hope you see where I'm going with this. To explain it a different way, all the sets that I can imagine that are capable of being constructed within ZF are (perhaps not directly) but inevitably dependent on only what is contained within a set, hence it seems that the axiom of extensionality is implied. Is there a flaw in my logic?