Until 13th century in Japan, there weren't visible castles except the low stone barriers or wooden fences.
The famous castles such as Himeji, Nijo, Osaka, Nagoya Castles etc. were built in 16th century of Sengoku Jidai(The Era of the Great civil war)
Why Japanese didn't build the catsle until the 13th century?
Because Japan had been
isolated from East-Asian Continent in military terms by the 13th century AD,
before Mongolian Invasion.
Before Mongolian Invasion, there was no Group tactics even in battle.
One to one tactics was
the battle style of Samurais.
(At this time, Samurais hardly wielded their Katanas in the battle.
They
mainly fought with Bows and Arrows just like this
illustration below.)
The typical Samurai in Medieval Japan was
the Archer Cavalry, not Katana-wielding Samurai
The stereotype of
Katana-wielding Samurai was made
after Sengoku Jidai Era in 16th century
Even in
Genpei War(Taira vs.Minamoto) of the 12th century, there was
no siege battle, either.
Although within 200 years after Mongolian Invasions, Japanese didn't constructed noticeable castles.
But,
15th century of Civil War forced Japanese people to construct the castles or fortresses.
In Civil war of 15th century, Group tactics began to used,
and Ashigaru(light Infantrymen) began to play active parts.
Group tactics influenced the construction of the Castles(Shiro) in Medieval Japan.
So, there were no visible castle(Shiro) in Medieval Japanese Islands of 12th~13th century.
Of course, the cities were not surrounded by the barriers or Castles.
All of the Japanese cities were opened at that time.