I’m sorry that I didn’t understand your requirements clearly.
Another approach could be to define your own Dataset which returns two tuples instead of one (one per dataset each with data and label) in the __getitem__ method. This way you could define the way, the data processing and indexing is done. I will try to provide some sample code with my mobile phone. I cannot guarantee it to work, but it should give you an idea how to do it.
EDIT: Dataset example code:
class DoubleDataset(Dataset):
    
    def __init__(self, path_1, path_2, transforms=None):
        self.data_1 = [os.path.join(path_1, x) for x in os.listdir(path_1) if x.endswith(".png")]

        self.data_2 = [os.path.join(path_2, x) for x in os.listdir(path_2) if x.endswith(".png")]

        self.transform = transforms

    def __getitem__(self, index):
        _data1 = custom_load_fn(self.data_1[index])
        _data1 = custom_load_fn(self.data_2[index])

        if self.transforms is not. None:
            _data1 = self.transforms(_data1)
            _data2 = self.transforms (_data2) 

        return _data1, _data2

    def __len__(self):
        return min(len(self.data_1), len(self.data_2))

This way you could train your networks like:
for data1, data2 in dataloader:
    pred1 = model1(data1[0])
    pred2 = model2(data2[0])

    optim1.zero_grad()
    loss1 = loss_fn(pred1, data1[1])
    loss1.backward()
    optim1.step()

    optim2.zero_grad()
    loss2 = loss_fn(pred2, data2[1])
    loss2.backward()
    optim2.step()

If setting shuffle=True the data loader gives a random index to the dataset and the dataset then returns items of both datasets with the same index