Now, of course you remember that this Tonic-Dominant relationship arises from the adjacency of the fundamental tone, in this case G, with its first overtone that basically is a fith, and from there the music proceeds by a circle of fiths, a downward circle of fiths, to its relative Major, B flat, wich is exactly where it's supposed to be for the appearence of the second thematic section. 