Hi - I had something similar. As well as the door open warning light, all the internal lights were on too (main roof light, the side-door footwell light and tailgate light). There is a 'switch' build into the rear latch on the tailgate that activates these and the warning light circuit.
For me, the switch was working fine - you can test this with the tailgate open by using a large screwdriver to flick closed the catch lever - as if the latch has hit the striking plate (and then release it as normal, with the rear tailgate handle). If that turns the lights off, then there's some kind of mis-alignment between the latch and the striking plate - or wear. This is what was happening for me - and the latch was not catching fully and just holding on the secondary burst-lock. Annoyingly, unlike a lot of cars, the striking plate can't be adjusted but loosening the bolts and sliding it about. However, for me, I did loosen then and try to shift it rearwards a little, before re-tightening. This works enough so that a good slam will close it.
However, if the switch isn't working (light stay on even when you use the screwdriver) or there's too much wear to take up - you may need to replace the latch. There are some cheap ones on Aliexpress and ebay - but I'm not sure what the quality is like. Check the code on epc-date.com if you need to get a compatible one.