All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ʻalayhi wa sallam, is His slave and Messenger.
Allaah, The Exalted, says (what means): {...a boy whose name will be Yahya. We have not assigned to any before (this) name.} [Quran 19:7] There are several interpretations of this verse; one of which is that he has no equal in his attributes, or that no woman has given birth to someone similar to him (in terms of character and righteousness), as in the verse where Allaah, The Exalted, says about Himself (what means): {...Do you know of anyone similar to Him?} [Quran 19:65] Another interpretation is that no one bore that name before him.
Ibn Katheer wrote:
“QatadahIbn, Ibn Jurayj and Ibn Zayd said, ‘This means that no one had this name before him.' Ibn Jareer preferred this interpretation. Mujaahid said that the verse means that none before him was similar to him. He deduced this meaning from the verse that reads (what means): {Lord of the heavens and the earth and whatever is between them - so worship Him and have patience for His worship. Do you know of anyone similar to Him?} [Quran 19:65] The verse means that none is like or equal to Allaah, The Almighty. ʻAli ibn Abi Ṭalhah narrated from Ibn ʻAbbaas that it means, ‘No barren woman gave birth to someone like him before.’” [End of quote]
Based on the interpretation of Mujaahid, the second one, and the third one as well in the previous quote, there is no problem in the first place. The verse means that there had been no one like him before in terms of his unique character traits and righteousness. He was honorable, abstaining (from women), a prophet from among the righteous, and was blessed with sound judgment while yet a boy (as praised in the Quran).
The first interpretation, on the other hand, is not reported on the authority of an infallible source entailing using it to challenge what was stated in the Quran. Moreover, one should know that the present-day versions of the (other) divine scriptures have been altered and distorted by means of omission and addition as Allaah stated in several places in the Quran. Please refer to fatwa 90449. How can you be sure that the verses in the present-day Bible referring to other people before Yahya who bore the same name were not falsely added to the original Book (Gospel) revealed by Allaah?
Hence, there is no problem with the first interpretation as well because the Quran is dominant over the past divine scriptures. The Quran confirms early scriptures and is a trustworthy witness over them; it testifies to the authenticity of the parts that have not been altered and distorted and judges the others that have been added or omitted.
As for the false claims that the Prophet, sallallaahu ʻalayhi wa sallam, got confused, this implies accusing the Prophet, sallallaahu ʻalayhi wa sallam, of being dictated by some of the People of the Book and authoring the Quran. Verily, this is false and unfounded; the Prophet, sallallaahu ʻalayhi wa sallam, was illiterate and could not read or write. Allaah, The Exalted, says (what means): {And you did not recite before it any scripture, nor did you inscribe one with your right hand. Otherwise the falsifiers would have had [cause for] doubt.} [Quran 29:48] In fact, the polytheists accused the Prophet, sallallaahu ʻalayhi wa sallam, of borrowing the Noble Quran from some of the People of the Book and Allaah, the Exalted, refuted their false accusation as He says (what means): {And We certainly know that they say, "It is only a human being who teaches the Prophet." The tongue of the one they refer to is foreign, and this Quran is (in) a clear Arabic language.} [Quran 16:103]
The Quran is the ultimate Truth; falsehood can never approach it from before it or from behind it. It is a revelation from a Lord who is Wise and Praiseworthy. There is no room for the unfounded false claims questioning its authenticity or challenging the established fact that it is the ultimate truth revealed by Allaah. It is impermissible to judge what is stated in the Quran based on that which is stated in the present-day altered and distorted scriptures; the Quran is the criterion over the previous divine scriptures and not the other way around. Allaah, The Exalted, says (what means): {And We have revealed to you (O Muhammad) the Book in truth, confirming that which preceded it of the Scripture and as a criterion over it. So judge between them by what Allaah has revealed and do not follow their inclinations away from what has come to you of the truth...} [Quran 5:48]
To sum up, the interpretation of the verse that you find problematic has not been reported from an infallible source. In addition, the other interpretations of the verse can spare us this problematic point, assuming that the assumptions proposed in these books are true.
Allaah knows best.