I can't remember which of the players I was watching when this type of topic came up. I remember the reply "the melody will usually work".
Two things I don't see a lot of traffic about here are using a melody line as (at least) an undercurrent in your solo, and listening to what is being played and trying to interact with it (or even against it).
I feel that at least part of the playing is expression. I guess that is why I really don't like jam tracks per se. I feel like it becomes a mechanical exercise, identify the chord progression, analyze the timing, review your repertoire and select menu items from there to fit into the track, really? (The VJR feels way better than jam tracks even though that is it essentially, in there we can still hear what someone had going on before opening fire with six strings, unless your first up)
All that stuff is fine but if you get back to the "story telling" aspect of music (BB talks about it, many other too), the melody is doing the telling. That is the part you can hum or whistle, or sell. I believe the solo can be an interval that builds on the musical scene that is present, only if the player listens and at least plays with awareness of the other movement in the band and the main theme of the song, the melody.
I know there are tons of powerhouse players who are a force unto themselves. I still bet you know your favorite tunes by the melody.
If I want to improve pentatonic soloing I would run about 20 minutes of them each day just for finger movement, ear training, and embedding the sound and finger rmovement deep. Like a zen, meditative period in the day, good posture, even breathing and feel the metronome, yeah. Oh wait, I do and I do.
Soapbox dismount.