Why are Costa Rica, Panama and Colombia culturally similar if Costa Rica never shared the same state with them?

I know in the case of Colombia and Panama the reason for the closeness is pretty obvious. But Costa Rica seems to be closer culturally and politically to Panama and to a lesser degree Colombia than to the rest of Central America and Mexico.

The three have similar accents particularly Costa Rican and Colombian. The three use “usted” as informal which is uncommon whilst “tu” and “vos” are more common in Central America and Mexico.

Both Costa Rica and Panama have no armies, similar economies (being two of the richest in the region) and stable democracies with former two-party systems that then split into multi-party systems. The later can also be said about Colombia.

Now Costa Rica never was part of Grand Colombia, was part of the Viceroyalty of New Spain, later very briefly of the Iturbide’s Empire and then Central American Republic, shouldn’t have more similarities with the north?