Classical musicians (Chopin, etc) were noted for their improvisational capabilities, and there were many famous jam sessions throughout their respective time periods. Unfortunately, the technology didn’t exist to capture those moments, so we can only imagine what may have transpired.
Baroque was a particularly strong time for improvisation - Bach was more well known as an improvisor in his life time than a composer (or for his educational pieces which is what he was known for right after his death).
At music school I knew a few baroque improvisors, a good one on the harpsichord is one of my favorite music, really miss that.
Chopin really played with time, and his enclosures and chromatic trills are heard later in musicians like Django Reinhardt. No doubt of influence in Jazz for my ear, as music is a continuum of evolution, even if some artists like Monk bring a new oblique perspective.