I'm confused about the C major scale and where the major chords are

But shouldn’t the notes of the second chord of the D scale (therefore E) be: E G B?

Yes but that is Em(E G B) the second chord in the key of D.

E is E G# B coming from the 1 3 5 of the E major scale. E F# G# A B C# D#