Cosmology with higher-derivative matter fields