Ainu were able to preserve themselves because they are on an island away from the Japanese mainstream. Hokkaido is too cold for most Japanese to be interested.
The Ainu "preserved themselves" by living on the Asian Mainland while the Jomon lived on the Northern Japanese islands. Sometime in the 1300s the Emperor finally subdued the last of the Jomon and relocated them South to the main islands where they were turned into the Samurai and used against Southern kingdoms.
Once the Northern islands were pretty much depopulated, Ainu moved in.