In answering this question, we should first note what Jesus does NOT say, namely, "It is written in the law ... " That is, Jesus does NOT attribute the aphorism to the Bible prophets, despite the fact that part of it does come from Lev 19:18 as the OP has correctly quoted.
What Jesus DOES say: "You have heard that it was said ..." Thus, Jesus attributes the aphorism to what is SAID, and not what is WRITTEN.
One presumes that this was either:
- a common saying among people, or
- a teaching of one of the schools of one of the Rabbis
In either case, it is not written in the Bible. This is expressed well by Ellicott -
(43) Thou shalt love thy neighbour, and hate thine enemy.—In form
the latter clause was a Rabbinic addition to the former; and this is
important as showing that our Lord deals throughout not with the Law
as such, but with the scribes’ exposition of it.
Benson is similar:
Ye have heard, that it hath been said, Thou shalt love thy neighbour and hate thine enemy — God enjoined the former part of this precept,
Leviticus 19:18, and the scribes added the latter, abusing, it seems,
the commands for destroying the Canaanites, to countenance such an
addition, though this was in direct contradiction to many other
scriptures. See Exodus 24:4-5; Leviticus 19:17; Proverbs 25:21.
The Jamieson-Fausset-Brown Bible Commentary is similar:
Thou shalt love thy neighbour—To this the corrupt teachers added,
and hate thine enemy—as if the one were a legitimate inference from the other, instead of being a detestable gloss, as Bengel
indignantly calls it. Lightfoot quotes some of the cursed maxims
inculcated by those traditionists regarding the proper treatment of
all Gentiles. No wonder that the Romans charged the Jews with hatred
of the human race.