The non-diatonic major 3rds of the last two chords are both "leading tones" that resolve to the roots (tonics) of the immediately following chords, i.e. G#(Maj 3rd) => A(Tonic), and C#(Maj 3rd) => D(Tonic), if you added the min 7th (dominant 7th) to each chord (D added to E = E7 and G added to A = A7) it would create a tri-tone (very unstable/restless/dissonant/tense) together with the 3rd of the respective chord (G# and D = tri-tone / C# and G = tri-tone). This resulting tension creates a sense of movement... or maybe unsettledness or "dissonance" that tends to want to "resolve" in a certain way. With the G# & D in a E7 the G# => A and the D => E; in the same way the C# and G want to go to D and A (respectively) because of the tension introduced by the tri-tone.
Incidentally... the last 3 chords are properly represented by V/V => V => i... (or V7/V => V7 => i if you want to add the dominant 7ths).
My own opinion here is that you can literally play anything you want to over the dominant 7th chords as long as you resolve it to the following chord... i.e. for E7: G# dim arpeggio, E "super-locrian/altered scale" (7th "mode" of melodic minor), octatonic scales (whole-half, half-whole) based off the previous leading tone (diminished arp. again), whole-tone, chromatic, different pentatonic scales, chromatic/diatonic passing tones, appoggiaturas, etc... (personally I tend to be adventurous here and have a completely "anything goes" attitude… even something completely random as long as you bring it back home at the right time, in the case of E7 to A come back to A maj and then go "out" again until you need to resolve when you hit dmin)... look for chromatic resolutions back to the diatonic sound or most strongly to a chord tone of the following chord (most of this can pretty much be explained by the concept of tri-tone substitution... an inverted tri-tone is still a tri-tone and implies another possible root or tri-tone above/below the root of the V which ends up being a half-step above the "tonic" or root of the target chord).
Basically your desire to add the G# and C# over the E and A is simply a desire to play the right quality of 3rd (maj vs. min) on top of the maj E and A chords (you are simply matching the scale/mode to the chord or "playing the changes", a very common and accepted technique for improvisation over chord changes). Note that you'll want to return to G and C natural over the dmin at the end... remember G# resolves to A (G natural is reintroduced as the 7th of A7) and C# wants to go to D (and C natural comes back as the 7th of D). If you don't change these notes in the way you've described you'll hear the clash of a minor 2nd over each... G# against G and C# against C... although, like I said, you can get away with it if you do it the right way (left unchanged they would be a #9th altered dominant sound and turn into dominant 7ths of the following chord... but if you don't play the tri-tone and then resolve it as well they're more likely to sound odd... so if you want to play the G and C as a #9 tonality you still need to add the G# and D as well as the C# and G respectively to E and A).
I should probably add that my answers here in relation to tri-tone sub. theory would be identified as more "Jazz" than "Classical", although personally I don't like drawing a distinction.