I agree that the current global locking on getInstanceFromFactory method is wrong. I am inclined to remove it completely. I saw your suggested patch and we will discuss this fix/issue more in deep as we don't want to create another regression in other areas related to using factories.
I have applied your patch with a little changes.
So as a summary:
There was a problem with too wide locking which could cause a deadlock. This is now fixed by reduced locking in case of calling Factory method. More details in JBSEAM-4861 or JBSEAM-4993