You cannot directly modify the jcr:createdBy property as it is protected. Instead, you should create the content fragment using a ResourceResolver that is authenticated as the user who started the workflow. This way, the jcr:createdBy property will be set correctly.
String userId = workflowSession...