Melody, playing melodically, is not the only way to comment and solo. Some players do indeed focus on melody. Grant Green most often solos melodically, in a linear fashion. His solos are coherent compositions. Other players focus on rhythm as much as melody. The panamanian pianist Danilo Perez always comes to mind:
Here he is doing an extended tribute to Monk, whose compositions are such idiosyncratic blends of odd melody fragments over surprising rhythm changes. Which illustrates another point. Soloing is contextual. Songs are thematic not only in melodic terms.
I'm no jazz player, but have studied jazz guitar, have jazz tendencies in my own playing. To me, solos and comments (obligato) are conversational. Expository yes, not always strictly melodic. More like the give and take, the ebb and flow of an actual conversation. Sometimes the conversation is highly melodic. Check almost any recording with Lester Young and Billie Holiday. More than just a soloist, the Prez actually sang along with her in verses via obligato comments:
And there's a whole lot of jazz which very intentionally departs from, moves past melody. The chaos factor. Coltrane's sheets of sound. Sonny Sharrock, who could be the most melodic guitarist and the least all in the same song. Here's a cut from his brilliant album "Ask the Ages". The great Elvin Jones on drums too, plus Pharoah Sanders:
Another from the chaos side. The Mary Halvorsen Jamaaladeen Tacuma duo. Mary on guitar. There is melody here, but melodic playing is not really what this is about. This is a conversation too:
from the album Jamaaladeen Tacuma & Mary Halvorson Strings & Things
jamaaladeentacuma.bandcamp.com
Me, I love the chaotic stuff.