There isn't really any one "right" way to learn to sing a song, honestly.
Experienced solo singers tend to listen to a song and sing from what they hear, or occasionally in some more rigorous contexts read from the sheet music and sing from that. Most singers assume they will be able to find their note and sing the melody over any chord or harmony within reason, they don't tend to need to lab things out on the piano unless it's particularly tough for some reason, say, strange harmony part or tricky melody. This is possible because they have trained their ears (ahem: brain) and can pick up melodies with ease; this skill comes from lots and lots of experience. Either that or they are confident in their ability to fill in what they're not sure about with something stylistic (improvising). It's all about pattern recognition, and most contemporary songs have melodies that are full of familiar patterns for those acquainted with the style!
In group singing, this is much more common. The singers have to use sheet music to learn their parts efficiently since often the supporting parts will be hard to hear and more difficult to execute or memorize. Since group singing parts are often considerably less "singable" (melodic) than the main melody of a song, they may indeed sit down at a piano to help learn the part. This, in my experience, is helpful to hear how the intervals and notes feel to sing, and playing the vocal part against the chords can also help the singer feel out where they need to be in relation to the harmony and other vocal parts in order to lock in. So in a choir, acapella, barbershop, or other group setting, this practice is a time-honored tradition... even now in the age of listening to your part off a MIDI track or notation software file!
But even sticking to more casual singing, some newer singers who are less experienced may feel that taking a more in-depth look at the part is helpful. After all, the piano is a great tool to help newer singers be confident with intonation and finding the right notes. It's also particularly common for piano players who are learning to sing, as they may be much more familiar with reading the vocal part from sheet music and playing it. Some who have difficulty learning by ear may find it necessary to study the written notation at the piano to figure out how to sing it if listening won't do the trick.