What happened is not a bug. In your turn 3 you were correctly returned from your buy phase to your Action phase and got the +1 Action (you can see the latter if you set the option "Log all +Actions, +Buys, +Coins" to "Yes" in then options tab).
So you were in the Action phase with exactly 1 card in hand (Estate) that made the game advance automatically to your buy phase. You had no Treasure in hand and no buy (you spent it on the Villa), so the game advanced to the Night phase and then the Cleanup phase.
Take a look at a continuation of this game: #29438872.
At the point it ends you have to decide between the Villa effect and the Changeling effect in turn 7. If you choose Changeling first, you will correctly end up in your Action phase, because now you have an Action card in hand that you could play (a Villa you had in hand the whole turn), so the game does not automatically advance.
Similiarly, if you undo to turn 6 and play only 4 Copper and buy a Villa, you have again to decide the order of the effects. If you choose Changeling first, the Villa effect will return you to your Action phase but then automatically advance to your buy phase, as described above. Since you now have a Copper in hand, the game stops the automatic advancement and allows you to play the Copper.