Typical discourse on this style of music would call this an Augmented 6th chord, rather than a tritone sub for the V7/ii. I actually pulled up a recording of this piece1 to verify that my ears agreed with my eyes, and I think it's worth a deeper look:
Getting into specifics, the key of this piece is clearly E major. Haydn starts with a couple soft I-V2 movements, then he begins using diminished chords to explore outside the key. Starting in measure 5, the progression is:
E - A#°7/E B/D# | F#7/C# - - B |
E - B+/D# E | ?? - - - |
B/F# - F#7 - | F#7/B - B (B7) |
Haydn uses these dissonances to make his way into a temporary B major key center, and the chord in question is his pivot between the two keys. If we use Roman Numeral Analysis,2 we get this:
I - vii°43/V V6 | V43/V - - V |
I - V+6 I | Ger+6/V - - (E -> B) |
I64 - V7 - | I762 - I (B -> E) |
Measures 8-10 all center around the dominant key of E, B major. The chord in measure 10 is a setup to get to B, so Haydn had many harmonic choices available, but he chose the German augmented 6th [G B D E#], which as you noted, is why it was spelled with an E# instead of an F.
Why not call it a tritone sub for the V7/V (or V7/ii from an E major perspective)? Well, I would point out that the E# creates the voice leading pattern E#->F#, which in B major is #4->5. In a tritone substitution, we would typically see that F resolve down to E, à la G7 F#7 B
. Spelling is telling, and this is a great example of how the resolution of the note influences its enharmonic spelling! Haydn seems to have taken care to notate pitches according to voice leading functions as the chromatic note F double sharp appears in measure 7 along with other examples throughout the piece.
Also, we do see this +6 chord resolve to the cadential I64 and then to V7, which is a typical progression of the time3. The cadential 6-4 as an extension of the dominant and tritone substitutions originate from different musical contexts and rarely appear together, adding further weight to the augmented 6th theory.
The long and short of it is that your instincts were right, it's an Augmented 6th chord, and it's being used to modulate into the dominant key (or it's a lengthy secondary dominant maneuvre, same difference). Haydn passed away in 1809, so his music would definitely be more effectively analyzed under western classical music frameworks than the 20th century jazz music theory that would give rise to tritone substitutes and the like - although I should say, look at it however you like, of course. Whatever makes the most sense to you!
1. I discovered while listening that this recital performance features the second violinist misreading measure 9's D# as a D natural, which confused me for a while while reading the score. I later verified that other performances do in fact play a D#.
2. Here I chose to analyze measures 9-10 relative to B major rather than get tangled up in all the secondary function symbols. Also, I have no idea what measure 10's first chord should be labelled in proper RNA, so I just wrote out the intervals as if it were figured bass.
3. I've heard it claimed that since resolving a Ger+6 chord to V7 directly introduces a parallel fifth, composers preferred the Italian and French versions or resolving to the cadential 6-4 instead, but I have no source for that.