To keep things manageable, I’m going to interpret the OP’s “absolutely necessary for a well-stocked library” to mean “Enough to give you a good idea of the what the major composers and their works are like, so that you can go on to further explore the ones that appeal to you,” and leaning towards the big hits rather than quirky personal favorites…
Bach: The Brandenburg Concertos, a sample of his vocal music (perhaps the St. Matthew’s Passion, the Mass in b minor, or one or two of the better known cantatas), and a sample of his keyboard music (perhaps the Italian Concerto or one or two preludes’n’fugues from the Well-Tempered Clavier).
Handel: The Messiah (or at least a disc worth of highlights), Water Music, Royal Fireworks Music
Vivaldi: The Four Seasons (Yeah, it’s his greatest hit, for a good reason.)
Haydn: At least one symphony (preferably one of the later ones) and one string quartet (I like “The Lark” (Opus 64 #5), but one of his Opus 76 quartets would do just fine).
Mozart: Symphonies 40 and 41 (at least), Piano Concertos 20 and 21, Eine Kleine Nachtmusik, at least one of his wind concertos (maybe the Clarinet, the Flute & Harp, or the fourth Horn) and maybe one of his violin concertos.
Beethoven: Symphonies 5, 6, and 9; one of the concertos (Piano Concerto #4 or 5, and/or the violin concerto); a few piano sonatas (Moonlight, Waldstein), the Archduke Piano Trio.
Schubert: The Trout Quintet, some piano music (maybe the Impromptus), some songs.
Mendelssohn: The Violin Concerto, the Italian Symphony, the Midsummer Night’s Dream overture.
Schumann: One of the symphonies (maybe #1), Carnaval, the Piano Quintet, Dichterliebe
Brahms: One of the symphonies, the Violin Concerto, the Piano Quintet
Chopin: At least a disc’s worth of piano music
Dvorak: The “New World” symphony, and maybe also one of the others; the “American” String Quartet; maybe a Slavonic dance or two
Tchaikovsky: The First Piano Concerto, the Violin Concerto, one of the last 3 symphonies, one of the ballet suites, the 1812 Overture
Rimsky-Korsakov: Scheherezade
Berlioz: Symphonie Fantastique
Mahler: 1st or 5th Symphony
Richard Strauss: At least one of the tone poems