Keep in mind that not all sailplanes are designed for extremely light weight. Decreasing the weight also decreases the minimum sink rate, but doesn't help the still-air glide ratio, and actually hurts the glide ratio against a headwind.
Even in sailplanes that are designed for very light weight, designers have sometimes thought it worthwhile to employ a rather large vertical fin. A good example of this is the Carbon Dragon.
The basic purpose of a vertical fin is to prevent the aircraft from flying sideways through the air, especially when the pilot makes an aileron input, which tends to create adverse yaw. Adverse yaw tends to be most pronounced in long-spanned, slow-flying aircraft.
Flying sideways is never efficient.
However, not all sailplane designers have always followed this philosophy. The Scheibe Bergfalke is an example of a glider with a rather small vertical fin. (Look closely at photos of this glider and you'll see that more than 75% of what appears to be the "tail" is actually the rudder, not a fixed vertical fin.) When flown with the pilot's feet off the rudder pedals, it tends to be rather uncooperative in response to aileron inputs, being quite happy to fly sideways through the air rather than actually turning.
Keep in mind also that a given desired "tail volume"-- the product of tail area times moment-arm-- can be achieved with less drag with smaller tail on a long slender boom (rear fuselage), than with a larger tail on a shorter fuselage. You've really asked two separate questions here-- "Why is the tail boom so long?", and "Why is the vertical fin so large?". The first question is easier to answer than the second-- the tail boom itself creates relatively little drag, due to its slender cross-section and resulting low "wetted area". To a first approximation, we can say that the tail boom is long so that the fin and horizontal tail don't need to be larger, to create the desired tail volume and flight characteristics. In truth, the story is a little more complicated-- when we dive into the details of spiral stability theory, we find that extending the tail boom while keeping the "tail volume" the same actually does produce significant changes in the aircraft's flight characteristics, due to that fact that the airflow and "relative wind" are actually curved whenever the flight path is curved.1 This also means that for a given "tail volume", the drag reduction resulting from extending the tail boom and decreasing the tail area will be less in turning flight than in linear flight.
One reason that modern sailplanes are generally designed with much larger vertical tails than vintage sailplanes--or most single-engine general aviation aircraft-- is that the long slender tail booms used in modern sailplane designs have a very small cross-sectional area and thus contribute very little to the aircraft's yaw stability ("directional stability"). Nearly all of the required "weathervane effect" has to come from the tail itself.
Certainly the purpose of the long tail boom and large vertical fin is not to "balance" the weight of the cockpit. Rather, the cockpit is placed in the optimum position to balance everything else.
Footnotes--
- Re "the airflow and 'relative wind' are actually curved whenever the flight path is curved"-- another way to say this is to note that in curving flight, the aircraft is rotating as well as translating linearly, so at any given instant in time, different parts of the aircraft are moving through the airmass in different directions. The instantaneous linear velocity at the nose and tail are different, and "tufts" or "telltales" at the nose and tail would not blow in the same direction. Details of the effects of the curving relative wind are beyond the scope of this answer, but it may be interesting to compare and contrast the designs of competition-level radio-controlled model sailplanes versus "free-flight" model sailplanes. Both have relatively long fuselages, but the former invariably have much larger vertical tails than the latter. The latter must be designed to fly in stable circles with no pilot input, while the former are designed for good response to pilot control inputs. The effects of the curving airflow in turning flight play a role in these dynamics.