Hmm I just tried, the wall keeps changing position, and I could cause the bug again, it happens if I first do the wall and then I do a turret. :/ (The wall doesn't turn for facing right position)
In some other cases, sometimes it turns into a wall corner, (which looks worse) or just weirdly keep the correct position.
So, I have to build turrets first, then fill between them with walls, and finally build the sensor towers or whatever else with an
empty space of one square.
EDIT: Another thing, don't worry very much about this, I was just playing another game called "Space Clash" and I had similar problems when building the walls.

So I think it's a common problem on other games.