There are 2 possibile explanations:
1. It could be that the "Elijah" verse has two different layers of meaning and that there will also be an Elijah before the second coming. (Elijah vs Jezebel in OT could also match that "Babylon"/"Jezebel" is still around at time of 2 Witnesses?) This would make 3 Elijahs (OT one, JTB, 1 of the two witnesses.)
Or 2. It could be that Elijah is just figurative as a similar type of person (or "spirit of Elijah"). John was right that he was not the previous Elijah of bc times. John is supposed to have worn John's mantle or girdle or something. Possibly this is abit like names like Caesar and Pharaoh, and the person bearing the name/title or "spirit" or mantle is identified as like being One with (or like a reincarnation of) the original first bearer of the name? Elijah prophesied to come before messiah is like John being forerunner of Jesus. (And Malachi is last book of OT just before gospels.)
Elijah before Elisha is also a type of John before Yeshua/Jesus (Elisha & Yeshua similar meanings), as is Moses before Joshua.
Though Elijah and Moses also have parallels with Jesus. Elijah also means El "god" = Yah, which might better match the son of god than John?
This could mean that there might only be 2 not 3 Elijahs (the OT one, & JTB, but not one in end times).
Either way John both was "Elijah" (2nd) but wasn't Elijah (1st) or Elijah/"Elijah" (3rd?) They are both true, there is no contradiction.
* Moses and Elijah are often thought to be the 2 Witnesses because the first's body was not found, and the 2nd didn't die but was raptured; and the types of signs the 2 witnesses perform are like those Moses and Elijah uniquely did; and the two appeared in the transfiguration; and Elijah is prophesied to come before the messiah. Plus possibly Moses & Elijah might be type of Jew/Law and Christian/Jesus, or of Law and Prophets (respectively)?
Good explanation, thank you.
I tend toward your number 2. Especially because of the transfiguration. Not that God cannot raise up these OT saints if they died but, these two fit the profile more I think.
Types also come into play, agree with that also. Not that it matters, just wondered what everyone else thought of the OP.
Thanks and God bless.