Was it necessary for them to flash their headlights behind me?

I was driving in the rain, and it was severe so it was hard for me to see and I remembered to take precaution while driving in the rain so I thought to drive a bit slower. A was following behind for a bit until we almost got to a traffic light and they flashed their headlights behind me and switched lanes. I’m not sure why they’d do this but I knew it wasn’t a good thing either way. Would they be in the wrong?

(Fairly new to driving)
Updates
+1 y
I meant a car*
Was it necessary for them to flash their headlights behind me?
Post Opinion