The door light indicator on the dash (and the beep) come on intermittently along with the inside dome light. I would imagine it is some kind of sensor in at least one of the doors that has gone, or is going bad, or a loose wire connection somewhere.
Yes a door switch has gone bad. I don’t think there is a way to narrow it down. Start with the drivers door. It gets the most use.
Yes to @Mustangman said. Might try disconnecting that driver’s side door switch. If the problem stops you found the faulty switch.
When there is a failing door ajar switch I get into the vehicle, switch on the ignition and push outward on each door to see which one activates the dome light.