It turns out that this is a known issue.
KB2345131: The logon screen appears two times when you resume Windows 7 from Sleep or Hibernation
The logon screen may appear two times. Therefore, you have to enter your credentials two times.
This issue occurs when there are multiple pending lock signals to be processed when the user is logging in. In this situation, the WinLogon state machine logs the user off.
Microsoft has released a preliminary hotfix. Because it is only preliminary, and most installations do not experience this problem, the hotfix has not been released in the normal automatic updates channel, which is why the problem hasn't been fixed automatically
yet. You can download the hotfix from Microsoft and install it manually.
I installed the hotfix on our computer which was experiencing this issue, and after three days the problem has yet to reappear, so it looks like this fix works.