Why isn't 4-hydroxybenzoic acid formed along with salicylic acid in Kolbe's reaction?
I don't understand why two different products are formed in the same reaction using very similar bases.


If the bases make a a difference, there must be a difference between them.
If the anion is the same, the cation must make the difference.

The difference between $\ce{Na+}$ and $\ce{K+}$ lies in the ionic radii of 0.95 and 1.33 $\mathring{A}$, respectively.
It is believed that $\ce{Na+}$ serves as an anchor and guides $\ce{CO2}$ into the ortho position during the formation of the Wheland intermediate. In the latter, $\ce{Na+}$ is chelated between the oxygen atoms of carboxylate and the phenolate. Apparently, this is very effective.
This does not mean that the phenolate doesn't attack $\ce{CO2}$ via C-4 at all. However, the formation of a Wheland intermediate (= the rate-determining step) is normally (and definitely in the case of the para attack) reversible.
It is open to question if full reversibility can be claimed for the $\ce{Na+}$ directed ortho attack under modest reaction conditions.
It is however likely that the back reaction (= cleavage Wheland intermediate) will stronger come into play at elevated temperatures. Consequently, some 4-hydroxybenzoic acid will be formed then.
With the bigger $\ce{K+}$, the anchoring and chelating effect is seemingly not possible, $\ce{K+}$ doesn't fit and the para direction effect of the phenolate prevails.