SHORT ANSWER: Focus on identifying and learning the common note intervals between melodic notes and root notes played on the main down beats. Read on for more details...
Yes, learning music theory will help ultimately. The problem though is that music theory is primarily descriptive rather than prescriptive in function. Music theory is primarily used to describe and communicate what notes to play and the specific relationships between notes. As a result, music theory doesn’t really tell you when to play specific root notes and corresponding chords to go with specific notes in a song’s melody, for example.
And yes, you can certainly learn chords and common chord progressions to play on your left hand. But here we have a similar problem - how does one know which chord progressions go with what specific song at the time you want to improvise and play the song (without relying on sheet music or pure memorization)? How do you add chords to a melody that you are making up on the spot?
So here’s what I do to begin learning and figuring out what to play on the left hand for whatever melody I’m playing spontaneously and by ear on the right hand. Focus on identifying the note intervals between the melodic notes played on the main down beats and the root notes! You can play a large majority of songs by ear using the following process.
Play ROOT note at 1, 3 or 5 intervals (+ 1 octave) BELOW melodic note played on (sometimes immediately after) main down beat with left pinky. Play intervals 1 or 5 for melodic note I, II, IV, V and 3 for II, VI, VII; 3 when melody progresses chromatically up & down; 2, 4, or 7 in melancholy or midsection of song.
Roll CHORD up & down notes at 1-3-5 or 1-5-8-to-10 intervals ABOVE root notes. Jazz up with 7-9. If you play the song in the key of C (minimizing use of black keys), you can for most of the time just freeze your hand into a three finger claw and roll the notes up from the root notes to play the chords with little or no thought.
Another suggestion: Play lots of songs off fake books that show only the melodic notes and the root notes (identified by the letters that specify the chords). As you play each song, play only the melodic and the root notes to help you quickly identify the number of intervals between the melodic notes played on the main down beats and the root notes. By doing this, you will quickly figure out (after playing just four or five songs) the common melody-root note intervals used to play certain types of songs and to play in various times and places within a song.
Once you figure out the patterns, you can read up on music theory to explore other options and ways to add variety to the left hand accompaniment (e.g. playing inverted chords to leave out the root note, selecting other types of chords to play off a given root note to create different feel or texture).