According to Japanese architect/architecture historian Terunobu Fujimori, there are two roots for traditional Japanese architecture: shrines and temples. Although you may consider them something similar, they are distinct. Shrines are for Shinto, and temples are for Buddhism. The first was born in Japan originated from long history of worship for natural deities, and latter was imported from the continent (India-China-Korea to Japan) during sometime 6th century.
He also points out curious characteristics of Japanese architecture: it is not defined by style but by functionality. In contrast to Europe, where churches defined architectural styles, which in turn defined contemporary culture in general such as Gothic, Japanese architecture never had overarching style. Religious architecture had its own protocol, residential buildings developed their own styles (shinden-zukuri to shoin-zukuri), and of course, the majority of people (peasants) build and lived in minka, small houses focused on day-to-day living.
In traditional Japanese architecture, there weren’t “architects” (The discipline of architecture was imported from Europe in the 19th century). Skilled carpenters supervised both designing and construction, and shrines and temples hired/supported highly skilled/dedicated ones who knew everything from how to select/treat timber (traditional Japanese buildings were almost exclusively made of wood, and hinoki –Japanese cypress – was considered the highest quality), which ones to use at which place, and how to realize complicated design that supported heavy weight on its own. They came to be called “miya daiku,” and were regarded as the guardian of the most authentic traditional architecture. Arata Isozaki – the 2019 Pritzker Laureate – describes “miya daiku” as properly trained, highly skilled carpenters who could work on “kumimono,” and “nageshi.”
It can be said that shrines and temples have been the most formal types of architecture supported by the national authorities and highly skilled carpenters. But as mentioned earlier, miya daiku never worked on other types of buildings, which meant other buildings had to be made other carpenters.