The sequence is too meta We start with a blank 1-indexed sequence:

_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,...


In the nth step, we fill in every a(n) blanks with the integers greater than 1 starting at the first remaining blank, where a(n) is the nth entry in the sequence.

After the first step:

2,_,3,_,4,_,5,_,6,_,7,_,8,_,9,_,10,_,11,_,12,_,13,_,...


Note that a(1) has to be 2 because the first integer greater than 1 is 2.

In the second step, we fill in every a(2) blanks. It will be apparent that a(2) must be 2.

2,2,3,_,4,3,5,_,6,4,7,_,8,5,9,_,10,6,11,_,12,7,13,_,...


In the third step, we fill in every a(3) blanks. From the sequence, a(3) = 3.

2,2,3,2,4,3,5,_,6,4,7,_,8,5,9,3,10,6,11,_,12,7,13,_,...


In the fourth step, we fill in every a(4) blanks. From the sequence, a(4) = 2.

2,2,3,2,4,3,5,2,6,4,7,_,8,5,9,3,10,6,11,3,12,7,13,_,...


Eventually:

2,2,3,2,4,3,5,2,6,4,7,2,8,5,9,3,10,6,11,3,12,7,13,2,...


Task

Given n, return the nth element of the sequence.

The first 10,000,000 terms of the sequence can be found here.

This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.
Haskell, 80 67 bytes



g~(a:b)|let k!l=k:take(a-1)l++(k+1)!drop(a-1)l=2!g b
m=g m
(!!)$0:m


Try it online!

Haskell is the perfect language for defining an infinite list in terms of itself.