this was allready fixed on master (5.4.0) so meta data now have correct value for ParentProcessInstanceId. Moreover for 5.4. thehistory table was extended to keep this reference as well. Take a look here for history log query method that can give you subprocess instance based on parent process instance id
HTH