I just stumbled across something I think is a bug in the checkActive(user, context) method in the com.xpn.xwiki.XWiki class.
The method's declaration (Line 5096) is:
and later the active check (Lines 5108-5110) is made using:
So this method always checks if "context.getUser()" is active instead of checking it for the parameter "user", what would have been the behavior I was expecting.
The fix would be to remove the variable "username" and use "user" instead.