I just replicated and fixed exactly this behaviour (with 2016 F54).Hi all.
We made an unpleasant discovery today on our 2013 Clubman. After using the remote to open the rear doors, the bag containing the key was inadvertently loaded into the rear cargo area along with a large dog.
But when we went to retrieve it, we couldn't. The rear doors were inexplicably locked. With the temperature in the car rapidly escalating, we had to smash the side widow out.
Anybody else experience this phenomenon?
Having read OP, I tested how my car behaved, using the spare key.
Purely by chance the spare key's battery was on the way out - It still worked well enough for its buttons to lock/unlock etc, but not well enough for any of the comfort access features to work (so not the little buttons on handles).
In this state things worked exactly as for OP - key got locked in.
Replaced the keyfob battery and things work as advertised: On closing rear door with key inside the car beeps and thows open the rear door. (comfort access stuff also worked again).
Hope this is applicable to OP's car.