Sometime in the late Middle Ages the Emeshi pulled out of the North and moved to Fukuoka to serve as a repository of military force for use by the Emperor and the Daimyo.
That allowed the Ainu to relocate from continental coastal regions into the Northernmost Japanese islands without resistance or difficulty.
Talk about causing some problems in figuring out who came first, the Emeshi or the Samurai.
This has been figured out rather recently, but it definitely addresses the problem in Japanese shaministic folktale lore where the BADGER is the chief animal rather than the BEAR as with the Ainu.
The bear cult, though, extends all the way across the Arctic to Northwest Russia and suggests the Ainu were, in the past, far less isolated from world civilization than they now appear.