Once again the two voice texture makes things less obvious. If you look at the first complete measure after the repeat, you have an A7 chord. It's missing the 5th (E) but you have A, C#, and G natural. That's the V7 of D major (like the V/IV you wrote). What's happening in the next measure is the the A7 resolves to D, but there is a suspension (the soprano G) which resolves to F# on the second beat. So you should not really think of that G over a D in the bass being a G major chord that's missing the third (the B). Rather, if all the voices were there (ie if the missing fifth of the chord were present), it would be DGA resolving to DF#A, an extremely common kind of suspension and resolution.