This highlights the central premise of Christianity that it is the “accepting of Jesus” and not behavior that determines entrance into heaven or hell. The most vicious person imaginable who accepts Jesus on his deathbed will get into heaven. The most saintly person who has a last minute doubt will burn in hell for all eternity.
There is really no rationale why Christian theology is like this except to placate the vanity of God. It is because it has been “written”.
Occasionally our priests and pastors go “off message” and say that entrance to heaven is up to the “grace of God”… thus implying that it might be possible for someone to get into heaven who did not accept Jesus as their savior. But for the most part, they “stay on message” with the “saved” prerequisite. Going “off message” like this is dangerous for their ministry. People may decide it is no longer necessary to go to church!!!