I think I see better what you're after. I would put in the sub panel in the garage and also drop another ground rod at the panel, it will actually benefit the main service by having a 2nd ground separated by some distance.
Now, I can just about promise it would not meet code but yes, I believe you can feed power back to house 1 then on to the barn from the new sub panel in the garage.
__________________
|