How is "tell[ing] you what key the piece is in" different that defining tonic/dominant/leading tone relationships? Those relationships are the product of the whole/half step pattern that the key signature communicates. It isn't just important that G has 1 sharp, and it is F. That sharp actually defines the leading tone.
Sure, but I'd argue that's because the key signature is wrong. The correct way to notate that is with either a modal key signature a la Bartok or notate it as D with a constant natural on the C, showing that the tonal center is D while clearly notating the departure from the traditional major scale.
By this standard probably something like 30% of the music ever written has the wrong key signature -- and I've never seen a piece of non-major music with a correctly notated key signature!