Last note-off misplaced when Midi recording in loops

If you recording midi notes into a looping pattern, and the last note which started at the end of the pattern still was not lifted on pattern-restart, the note-off will be placed AFTER the next note. So two note-offs then will be messed up. I think here the last note-off simply could be left out, if a new note passed the playhead… Not sure which logic would make the most sense, how do other DAWs handle this case?
Maybe the whole note at the end then should be moved to the right, but this could make no sense for the sequence. I think in any case then, leaving out the note-off would be the better approach…?

We’re basically missing a record overdub mode here. Same would happen when overwriting existing notes in a pattern which isn’t looped.

Ok, but even with disabled overdub, the note-off of the prior note never should be placed after the next note… Don’t you agree?