Axiom of Regularity allows for this set be an element of itself

Just because a set appears to obey the axiom of regularity doesn't mean it actually is a set! The axiom of regularity restricts what sets exist: if a non-empty set exists, then it has an element that is disjoint from it. The axiom of regularity doesn't say that any putative collection which follows this rule has to actually exist as a set.

So, all you have observed is that if a set $A=\{\{1,2\},A\}$ existed, then $A$ would not be a counterexample to the axiom of regularity. This in no way proves that such a set actually exists! And in fact, if such a set did exist, then $\{A\}$ would be a counterexample to the axiom of regularity. This is a contradiction, and therefore no such set $A$ exists.


You have learned the formal statement of the Axiom of Regularity, but you don't have a good picture of what it means. Let me try to explain it.

Let me call $A$ a bottomless family of sets if, for every set $x$ in $A,$ there is a set $y$ in $A$ such that $y\in x.$ A counterexample to the Axiom of Regularity is just a nonempty bottomless family of sets; in words, the Axiom of Regularity just says that no such family exists.

For example, suppose there is an infinite sequence $a_1,a_2,a_3,\dots$ of sets (not necessarily distinct) such that $a_{n+1}\in a_n$ for every $n,$ that is, $$a_1\ni a_2\ni a_3\ni\dots\ni a_n\ni\dots\tag1$$ Then the set $$A=\{a_1,a_2,a_3,\dots\}$$ is bottomless (and of course nonempty); so the Axiom of Regularity says that the set $A,$ and therefore the sequence (1), can't exist.

Note that it is the set $A,$ and not (necessarily) any of the sets $a_n,$ which is a counterexample to Regularity.

Now suppose we had a "circle of sets", say $$a_1\in a_2\in a_3\in a_4\in a_5\in a_1\tag2$$ In this case $A=\{a_1,a_2,a_3,a_4,a_5\}$ is a nonempty bottomless family, contradicting regularity. Actually this is just a special case of (1) since we could write it as an infinite sequence: $$a_5\ni a_4\ni a_3\ni a_2\ni a_1\ni a_5\ni a_4\ni a_3\ni a_2\ni a_1\ni a_5\ni a_4\ni\dots$$ In the very simplest case, the Axiom of Regularity tells us that no set can be an element of itself. Namely, if we had $$a_1\in a_1\tag3$$ then (not $a_1$ but) the set $A=\{a_1\}$ would be a counterexample to Regularity.

In your example, assuming there is a set $a$ such that $$a=\{\{1,2\},a\},\tag4$$ then we have $a\in a,$ and so the set $A=\{a\}$ is a counterexample to Regularity.