This is a really interesting question. To me “improv” is just a shorthand for “improvisation”, which is different from composing a solo (like Hotel California) and playing the composition. To me improvisation sort of implies deciding what to play on the fly, as you are doing it.
As others have mentioned, the bits and pieces that go into your improvised piece of music can be (inevitably are) things that you have previously learned. Phrases and licks that might last a bar or two. (That’s why some improvised solos can sound “pre-planned”, especially by less experienced players whose bags of tricks are still fairly small.)
I guess the line between an improvised and a composed solo can be a little blurry. Let’s say I know 8 2-bar licks. If I play them in sequence, is that 16-bar solo an improvisation or a composition? I suppose if I play them in the same order each time I play the solo, maybe I’d call that a composition. If I randomly choose from my bag of 8 licks, 1 lick at a time, I’d be inclined to consider that improvisation.
I do wonder about the solos we hear, either on recordings or in concert, how many of them are composed and how many improvised? I gather that many (most?) of the iconic rock solos (I’m thinking Stairway, Bohemian Rhapsody, Hotel California) are actually composed. On the other hand, there are 3 versions of Let it Be, each with a different solo, which makes me think that George was probably improvising in the studio.
And certain types of music feature a lot of improvisation. Jazz, of course, blues, Grateful Dead/jam band-style music, prog. (Of course, these genres feature composed solos, as well).
Personally, I think learning how to improvise is pretty awesome. I can sit down and make (a semblance of) music after having learned 10 blues licks. I can play a thousand different solos (more actually), with those ten licks. It’s kind of exciting, to be honest.