CasIL: Cognizing and Imitating Skills via a Dual Cognition-Action Architecture