«وَمَاتَ عَلَى الْإِسْلَامِ»
“And died upon Islam.”
Belief at some stage is not by itself enough; the final religious state matters. If someone met the Prophet ﷺ as a believer, then left Islam permanently and died without returning to it, the technical definition is not fulfilled.
A different case: A person met him as a believer, later experienced an interval of apostasy, subsequently returned to Islam, and died as a Muslim. This cannot be treated as the same case as dying outside Islam, because the requirement concerning the final state is now satisfied.