In the preference settings under the "drawing" section the "Keep drawing on previous keyframe" is configured by default, so consider this as it will and has already affected new users.
The problem is that whenever you're drawing in an empty frame, even if you move back over to the "previous" keyframe, undoing any stroke will create a new keyframe with a copy of the drawing on the empty frame where the playhead was positioned at the time of the drawing. And not only that but if you keep pressing undo, it will undo the strokes on the copy, until the original state of the stroke previous to drawing on the empty frame, will be reached.
This is extremely frustrating even when knowing about it as sometimes you need to draw on a layer that only has a single keyframe, to trace the motion path or create a layout guide of an existing animation. So if you undo a single stroke, it will create the new keyframe for you and mess up all your drawings because undoing anymore will undo the drawing itself and leave you with a different copy.
Creating or deleting keyframes if you drew when the playhead was positioned over an empty frame should only work with the modes: Create a blank keyframe or Duplicate the previous keyframe.