Bugs can exist within a coding session. I consider that a normal part of the development effort. You think of some change you want to make. You make it. If you discover you made a typo or overlooked some issue and thus it has caused a bug, during your dev-testing, you fix it. Once the desired change is done, working as intended, with no bugs, that change-sprint is done and commited to your VCS. Then you end the dev session or advance to the next desired change. The key is that when your dev session ends, and when you are just wearing the user's hat, there should be no bugs. In my experience, bugs can be found usually quickly and easily within the same coding session that introduced a new feature, while the code and your recent change are all fresh in mind, and you are in The Zone.
That was a good heuristic you suggested, but I think it applies to situations where a bug survives beyond the end of a development session, accidentally.