You are right.
Lenses are not well corrected at the borders of the visible spectrum, especially the UV end, starting at ca. 410 nm.
Those color fringes occur at hard contrast edges. This is mainly UV light reaching the sensor. Due to imperfect chromatic correction fringes appear at the border.
The digital sensors are very insensitive to UV light, fortunately, but at such strong contrasts the light is intense enough so that a little fraction is reaching the sensor.
One can reduce this by using a strong UV filter. A good one is the B&W 420, which is blocking everything below 420 nm.
NB: With the UV filter you can of course only reduce the UV light.
You cannot reduce purple fringing that originates from the addition of visible red+blue light.