is there any way I could combine those two for each specific repo
Azure DevOps doesn't support such syntax $(resources.pipeline.PipelineA.repositories['repo2'].sourceBranch).
According to Pipeline resource variables,
In each run, the metadata for a pipeline resource is available to all jobs as predefined variables. These variables are available to your pipeline only at runtime.
But the resources are resolved before runtime, therefore, you can't use pipeline variables in the repo resource.
Besides, if you set the ref of the repo resource to one branch, you can only ensure two pipelines checkout the same branches instead of the same commits.
To ensure two pipelines checkout the same commits, we need consider some workarounds. In order to give you more accurate advice, please answer the questions in the comments to help us understand your scenario.