I had some time over the weekend to dig into this further and open the center console to get to the shifter lever mechanism. It turns out that there is a microswitch in there which detects the P position, it's in the middle of this photo:

I gave it a few flicks with a finger, then re-seated the connector (lower right), and the symptoms all went away! So probably either gunk in the switch or a bit of corrosion on the connector pins. ( (perhaps the switch will fail fully soon, but now I know what to do).)
It turns out this problem is fairly well documented, but moreso for keyed ignitions rather than pushbutton. For keyed ignitions, the main complaint is that the key can't be removed. Searching for "hyundai key stuck in ignition" shows basically the same fault. The symptoms are just a bit different on keyless cars.
Glad to have resolved it. I am just a little annoyed that the ECU didn't raise a DTC/fault given the discrepancy between the range/inhibitor switch and the lever switch.
(And
@Aye30 my OBD scanner could display the position of the transmission's range switch, so its there, but it didnt find the code for the shifter microswitch).