Probably to ensure compatibility for old browsers and mobile users. Obviously the more elegant solution is to do the animation client side and avoid rendering millions of videos but it's not the solution that would have worked for the most people.
Considering how facebook has more than a billion users from all the corners of the world accessing it from literally every internet connected device, they had to make something that would work everywhere. Doing it the video way seems like a good decision in this case, at the scale of facebook.