Notice that the sentence that you have bolded
If, however, nobody knows of the act, or he separated from her before the zealous
could kill him, his punishment is kares.
speaks of a situation in which there are no witnesses that can convict him. The halacha requires that he have been warned by witnesses who can testify in bais din so that he can be convicted.
Rambam Issurei Biah - Chapter Twelve Halacha 6 explicitly says
6 If the zealous did not strike him, nor did he receive stripes from the
court,18 his punishment is explicitly stated in the words
of the prophetic tradition. He is liable for karet,19 as
[Malachi 2:11-12] states: "Judah desecrated that which is sacred to
God, [by] loving and engaging in relations with the daughter of a
foreign god. May God cut off from a man who does this any progeny and
descendant." [Implied is]20 that if he is an Israelite, he
will not have progeny among the wise who will raise issues, nor a
descendant among the scholars who will respond. If he is a priest, he
will not have [a descendant] who "presents an offering to the Lord of
Hosts." Thus you have learned that a person who shares intimacy with a
gentile woman is considered as if he married a false deity, as the
verse states: "engaging in relations with the daughter of a foreign
god." And he is called one who "desecrated that which is sacred to
God."
18. The Maggid Mishneh writes that if he was given "stripes
for rebellious conduct" by the court, he is no longer liable for
kereit. Our Sages (Makkot 23b) state a similar concept with regard to
a person who receives lashes for the violation of a Scriptural
prohibition. The Rambam extends the idea to include a person who is
punished on the basis of Rabbinic decree.
19. This applies even if relations are conducted in
private.
20. As interpreted by Yevamot 22b, 23a.
As pointed out in the BACKGROUND TO THE DAILY DAF Yevamos 49
[line 3]כרתKARES (KARES AND MISAH B'YEDEI SHAMAYIM: Heavenly
Punishment of Untimely Death)
(a)Some sins are so severe that they are punished with untimely death.
There are two types of untimely death that are used as heavenly
punishments: Kares, and Misah b'Yedei Shamayim. Kares means "being
severed" from the world and dying before one's time. Misah b'Yedei
Shamayim means "death at the hands of heaven." These punishments are
not administered by the courts, but through divinely administered
justice.
(b)One who deliberately transgresses a commandment that is punishable
with either Kares or Misah b'Yedei Shamayim is punished even if there
are no witnesses to his act, and even if he was not warned at that
time of his transgression that his violation will result in his
untimely death.