This was one of my early questions and one of the first reasons that started pushing me away from religion.
At one point I asked my religion teacher in high school something among the lines of "So if a hypothetical person is the most good person on Earth from all the ways of looking at things, except he doesn't believe in God, does the latter invalidate everything else and he'd still go to hell?". She pretty much said yes.
Luckily she was chill about some of us in the class not believing. We just agreed to disagree, and while there were multiple debates on various religious subjects started by someone in the class questioning something she was saying, it never got heated.