How Chinese religion changed across dynasties