CA is fairly easy to correct in software. The camera sensor records the image onto the sensor using a bayer mask. So the red, green, and blue are all recorded on their own "photo sites" and later combined to create "pixels".
Light refracts through the lens and, just like a rainbow, the wavelengths of light start to split into their constituent colors -- just a tiny bit (achromatic doublets in the lens try to minimize the effect but cannot cancel it entirely.)
Imagine you separate an image to create a "red channel", "green channel", and "blue channel" version of an image. Then imagine shrinking the blue channel image by about 1%, growing the red channel image by about 1% but leaving the green channel image alone -- then recombine back into a single image. I'm making the percentage up -- but that's the general idea.
Since CA varies by how far a point is from the center of the image circle projected by the lens, the very center should appear to have virtually no CA at all... while the corners should have the most CA. This means that if you perform the correction right out of the camera, you can then do other things to the image with impunity. But if you start to resize and crop in sections of the image first (say you've cropped into a detail in the lower right corner) and THEN try to apply a CA adjustment, it may not work because the center of the image you see (post crop) was NOT the center of the image circle being projected by the camera lens when the shot was created
[*].
Part of the point of the camera having a built-in UV & IR filter is because those wavelengths, being at the extreme ends of the visible spectrum (but still visible to the sensor -- just not to human eyes) would cause even _more_ CA. By cutting IR & UV light, the image is sharper.