I'd like to chime in on this since I just started having this problem to.
It took me a while to pin it down. I tried an SMC reboot (pulling out the power cord for 15 seconds .. cool reboot huh?). But that didn't stop it. After looking through some of these comments I started looking at the crash log ... bunch of incomprehensible crap and didn't help at all. But then after looking through my library/launch agents .. I noticed I had a 3rd party app by Razer. I use a Razer mouse and installed the 'Synapse' software.
Now I know from my PC's that the Synapse software is crazy for updating like every 12 hours it seems. So I looked at the activity app and it showed the the rzupdate plug was running. After battling to get the window active long enough to force quit that process my 'deactivating window' problem ceased immediately.
So my problem was down to Razers crappy software, I like their hardware .. I have one of their Rzaer Blade laptops (sorry apple but you need to get your MacBook Pro's back to 'PRO' before I buy another one of yours again), and the synapse software doesn't even work well on that .. soooo.
So this thread was helpful to me discovering the problem. It will be different for everyone I guess if you have this issue. All I can say is that it's probably a 3rd party launch agent process that's trying to launch in the background and then being stopped by the system because it's either incompatible, or outdated etc. So check your library/launch agents .. and see what's in there. And check that it's a process that may be running .. and try force quitting it.
Thanks everyone for your input and reporting this problem. Hopefully my addition here will help anyone else who has this too.