This happens to me a lot. Just like your examples it happens in tight corridors or in doorways. I think it has something to do with where the characters are placed on the grid. In combat, characters seem to place themselves offset of the grid and it results in weird stuff like this it seems.