Yes, mollies eat their babies. Mollies are opportunistic feeders, so they’ll eat anything that can fit inside of their mouths, including their own babies.
In order to protect the baby molly fish, you should isolate the mother right before she gives birth. That way, the babies won’t get eaten by other fish right after they’re born. You can either install a breeding box in the tank or place the pregnant molly in a separate tank.
Once the baby mollies are born, remove the mother and put her back in the original tank so she doesn’t eat her fry. Take care of the baby mollies in their own tank while they’re still small.
After two weeks, you can put the molly fry into the main tank, because they’ve grown big enough that the adult mollies won’t mistake them for food.
If separating the baby mollies from other fish isn’t possible, fill the main tank with extra plants so the fry can hide until they’re big enough to defend themselves. The adult mollies may still eat some of the fry, which is why completely separating the baby mollies is ideal.