As described here: https://docs.plone.org/external/plone.app.dexterity/docs/advanced/defaults.html
It should be possible to define a defaultFactory which has a context, which should be the parent of the object you are creating.
This works as long you are using the Plone UI to create an object.
But if you create an object in Python with api.content.create or the old invokeFactory way, the context is the object it self and it has no Acquisition chain and therefor no parent.
I created an example addon to show this.
You can run one of the following test to trigger the creation of an object and the defaultFactory.