It's an annoying feature built into the phone software. I couldn't use dial pad touch tones or even hang up the phone once the screen blanked. (Unless I set it to hang up on power button press, which was also annoying because awkward for lefty phone use.)
Fixed it by installing another Dialer app and discarding the built-in Google/Android junkware... had to root the device to make the changes persistent after restarts.
I don't believe it should be any other way. When a phone is being held up your ear, there wouldn't be any way to relasticly be inputting codes or otherwise using the keypad. Also, the sreen being off when up to your ear is very important when using a touchscreen to prevent accidental touches.
The moment you take your phone away from being pressed against your ear, the screen is supposed to come back on, and does for every touchscreen phone that I've ever used. If that isn't happening, the software was programmed poorly, or there's something wrong with the censor.
It does happen sometimes.
I had these issues, Howerer reseting the phone or turning off completely helps.
Did you try that, If not try and see if that resloves ?
I had this issue when I owned an IPhone. Eventhough the settings were right, it always froze. Turned out that it was an update error and I managed to get the update again. Im not sure if this might be your issue.