I initially thought this seems related to the fingerprint sensor functionality being on the power button. It's almost as if there's a timing issue where fingerprint sensing interrupts the poweroff function in the software. But then I noticed that I get better response if I use a full finger press on the button compared to just my fingernail (I was trying to avoid fingerprint sensing), and even a pencil eraser works more reliably than my fingernail - so, is it a question of the button not being pressed "squarely" enough sometimes (which is exacerbated by having a case), or is it really related to fingerprint sensing (which gets confused by not having a large surface to sense)?
After many more rounds of button pressing, I am still leaning toward software rather than hardware on this, but I'm not sure.