Next time this happens, try pressing the “unlock” button on the driver’s door, then try the button next to the steering wheel again. Depending on how you set up the central locking/unlocking (if you have a MY2018, as I think that’s the first year they added auto locking), you can end up in situations where the key isn’t unlocked when you think it should be.
In mine, as delivered, it was set to unlock the doors with the driver’s door open. However, if I had multiple passengers in the car and the front door passenger opened their door BEFORE I opened mine, it would let them open their door and allow me to open mine, but it wouldn’t cause the rear doors/key to unlock. . For some reason, the two front doors, the inside door handle will override the lock, but not the rear doors.
I changed the setting to unlock when I put it in park. This helped, as it would unlock all the doors earlier. I then discovered that when I returned home with a passenger and cargo in the car, I could cause a similar problem. I stop on the road to let the passenger out. If they open their door before I put the vehicle in park (and it unlocks everything automatically), then when I pull into the garage and get out, it won’t open the hatch without manually unlocking it.
It may or may not be your problem, but it’s a free and easy check…