If you play piano you immediately see what notes construct what chord. For example you see on your keyboard that C Major is constructed of C E G. It's much harder to visual that on guitar even if you know fretboard well.
It's fairly important unless you're going to play via shapes and/or patterns. You can get away with it for a long time; I did, for the first 4 or 5 years of playing. As soon as someone asked you to play something for which you don't have a ready shape or pattern you're in trouble.
In my opinion, at a minimum you should know how to build simple chords on the fly:
I would also learn how to use the Nashville Number System, developed in the late 1950s and still in use by studio, stage and touring musicians in the music industry in Nashville, Tennessee and elsewhere.
This depends entirely on your aspirations. Different people think about music in different ways, and you need to find your own preferences.
If you're happy to strum or pick chords by learning shapes, then it's OK to just learn the shapes and play them without thinking about the rhyme or reason. It's definitely worth knowing which string is the root note of each chord shape, because a strum often sounds better if you start on the root, and the root note is the basis of a picked pattern.
From there, it's your choice how smart you want to be. It's never harmful to know more!
Bear in mind that many good classical musicians don't reason about the notes they are playing -- they just play what's written on the stave. It's not a learning style that works for me; but it works for many.
If you know the names of which notes you're playing, you can reason about how the chords are constructed. This makes it easier to remember the shapes because they are no longer just random clusters of dots to you; you can see patterns in how they're arranged.
There are two ways to look at this:
It's great to be able to do both of these, but you're likely to find that you're more comfortable with one and will have to work harder on the other. Which one it is, depends on you.
Then there's the opposite direction -- where you know what notes make a chord, and are able to construct a shape from that. This allows you to create your own inversions higher up the fretboard, rather than learning them all by rote.
Using a combination of all of the above, you can modify chords you know, to create new chords. For example:
So yes, it's very useful. But, if your ambitions are low, you don't need it.
I'd just like to say (quite seriously),
One of the many ways of becoming a better guitarist, is to know the notes which make up a chord
JimR gave you a good answer, I'd like to add my $.02 to that by mentioning that it'll depend on what you're playing and who you're playing with. For a long time I played in a choir's backing band, and we were mostly given sheet music matching the choir's arrangement. It was not uncommon to encounter chord progressions with 6s, 9s, flats and sharps, or with a non-root note in the bass. Knowing how to build chords made life easier for me since I could use it to figure out a guitar part that would have the right chords and fit with what the others where doing, as in this case "the others" meant both a bass and a keyboard player as well as a choir.