As above, the only time it will autolock on it's own whilst stationary is when you unlock the car but do not open any doors.
I charge my car in exactly the way that you have described you do, only difference being that I am plugging in before a scheduled overnight charge, so charging does not commence immediately.
I.E. Unlock car, open charge port plug in. In the meantime car has autolocked due to no doors being opened. There obviously should be no alarm, it would be a very noisy world if all alarms went off when charging.
As mentioned ensure there are no other reasons why alarm might go off. Try opening a door before plugging in, then close and lock manually after, if not already done.
Something is amiss either in operation or technically.