It's not a coincidence that Pakistan is more developed than Afghanistan.

> there are many third-world countries with ocean access

Think about it like this - the vast majority of people that manage to improve their station in life are smart. Not everyone is smart, and not everyone who is smart improves their station in life. Being blessed with natural gifts doesn't determine a nation's fate, but it damn sure helps. Critically, the absence of those natural gifts puts a country at a severe disadvantage when trying to develop (in this case safe, economical access to global markets via maritime trade - a very concrete and measurable asset).

It is not the whole answer, sure. As my original comment and your replies have point out, there are exceptions. Those exceptions are by definition unusual. Some other factor(s) needs to be working overtime to offset the natural handicap. In the case of these exceptional first-world countries we're looking at, their handicap is balanced by having good prosperous neighbors that provide cheap, secure access to maritime trade routes. Afghanistan does not have these compensatory advantages.

Insofar as LoN is concerned, I'll leave that to you to contemplate the very origin of the designator "first world" and what being part of the right "club" means for a nation's prosperity. It is impossible to separate the landlocked exceptions' success from the compensating "gifts" of their neighborhood, as explained by the UN info below.

Check it out:

https://www.worldbank.org/en/news/feature/2008/06/16/landloc...

"High prices have hit many countries around the world, but landlocked developing countries bear an extra burden.
Afghanistan, Central African Republic, Burundi, and other countries without a port pay more and wait longer for imported oil, food, and other goods. And they have an equally hard time exporting, with the result that they trade less and grow more slowly than their coastal neighbors."

https://www.nationsonline.org/oneworld/developing_countries....

"The United Nations term "Landlocked Developing Countries" describes countries with serious constraints on the overall socio-economic development. Due to lack of territorial access to the sea and therefore remoteness and isolation from world markets causing high transit and transportation costs. These countries are among the poorest of the developing countries."

https://webcache.googleusercontent.com/search?q=cache:BAK96b...

"For LLDCs, their seaborne trade almost always must transit through other countries, mostly also developing countries—a process which involves dealing with cumbersome border-crossing procedures and inadequate transit transport infrastructure. Thus, although LLDCs already face other development challenges, they also face substantially increased costs for trade and transport because of their geographic location. Moreover, of the 32 LLDCs 17 are classified as least developed.

Their remoteness from major world markets is the principal reason why many LLDCs have had less success in mitigating consequences caused by their geographical handicap as compared to landlocked countries in Europe. Landlocked developed countries of Europe are surrounded by major developed markets and their seaborne trade accounts for a relatively small part of their external trade. Their export is mainly high value added products and their distance from seaports is comparatively short.

The distances involved in most cases of LLDCs are excessive. Kazakhstan has the longest distance from the sea (3,750 km), followed by Afghanistan, Chad, Niger, Zambia and Zimbabwe with distances from the nearest seacoast in excess of 2,000 km. Transit time for goods of LLDCs is extremely long because of their remoteness, difficult terrain, road and railway conditions and inefficiency of transit transport."

Make sense? This is not "my" geographic determinism. It's a pretty well-established way to interpret the world.