Try the following,
$$\forall x
\forall y
( x \neq y \leftrightarrow
\left.
\left(
\neg x \neq x \wedge
\left(
\begin{array}{c}
( y \neq x \rightarrow x \neq y ) \\
\wedge \\
( x \neq y \rightarrow y \neq x ) \\
\end{array}
\right)
\right)
\right)$$
$$\forall x \forall y ( x = y \leftrightarrow \exists z( x = z \wedge z = y ) ) $$
$$\forall x \forall y ( x \neq y \rightarrow ( x = x \wedge y = y ) )$$
$$\forall x ( x = x \rightarrow \neg x \neq x )$$
$$\forall x \forall y ( \neg x = y \rightarrow x \neq y ) $$
In the classical logic of identity, there is an objection to what is called the priniciple of identity of indiscernibles. A singular term is said to convey "self-identity". So, "unlikeness" is neither a primitive or a simple negation (if it were, identity would follow from the inability to show that two singular terms differ). The second sentence above had been developed by Tarski. Taken as a definition for a non-eliminable identity, the definiens provides a semantic warrant for uses of the sign of equality. Because a diversity relation cannot convey "self-identity", a true diversity relation must imply the self-identity of its terms. If an individual term is self-identical, it ought not be diverse from itself. And, if an identity statement is false, a corrresponding diversity relation ought to be true. Note, however, that a conditional is used rather than a biconditional in order to respect the objection to the identity of indiscernibles.
Now, consider the eliminable defined equivalence relation obtained from the set-theoretic primitive,
$$\forall x
\forall y
( x \approx y \leftrightarrow (
\forall z ( x \in z \leftrightarrow y \in z )
\wedge
\forall z ( z \in x \leftrightarrow z \in y ) )$$
If the sentences,
$$\forall x \forall y (
\forall z( x \in z \leftrightarrow y \in z ) \rightarrow \neg x \neq y )$$
$$\forall x \forall y(
\exists z \neg( z \in x \leftrightarrow z \in y )
\rightarrow \neg x = y )$$
$$\forall x \forall y
( \forall z( z \in x \leftrightarrow z \in y )
\rightarrow
\forall z ( x \in z \leftrightarrow y \in z ))$$
are taken as axioms, one can prove
$$\forall x \forall y ( x \approx y \rightarrow x = y )$$
$$\forall x \forall y( \neg x \approx y \rightarrow x \neq y )$$
on the basis of the usual notion of extensionality in set theory as expressed through the third axiom.
However, to finish what has been done here, the sentence
$$\forall x \forall y ( \exists z ( x = z \wedge z = y ) \rightarrow x = y )$$
would have to be introduced into the logical schema with adjustments to the quantifier rules.
Philosophers would object to this on the basis that such logic rules would suggest what they call "contingent identity". This is fundamentally a metaphysical objection. So it is important to remember that the situation with set theory is such that the standard axiom of extension is not an eliminiable, defined equivalence. That axiom is structured specifically to defer questions about identity to the first-order predicate logic. That set theory is formulated in this way is typically attributed to the influence of Skolem.