Yes it is thought to provide safer milk, less vulnerable to every bacteria that respires and multiplies on sucrose, and which lets the baby grow faster due to higher sugar content.
Milk has evolved from pouch mucus, antimicrobal secretions of the immune system, Lysozyme in mucus is a glycoside hydrolase which ruptures bacteria cell walls. So the origins of milk are very different than for plants.
Lactose is a larger molecule than sucrose, so it exerts less osmotic effect per unit mass, allowing more carbohydrate to be included in am isosmotic secretion such as milk.
marsupials have mostly longer oligosaccharides and their milk contains 11-14% sugar,
zebras and and horses with only lactose achieve 7%
humans and other primates achieve 8-9% using milk and polysaccharides.
Another advantage is that it's a molecule rarely produced in nature, and fewer bacteria have evolved the enzymes required to digest it, upgrading the lac-operon to produce galactose-permease, save for beneficial lactobacilli, e-coli, and other mostly mutualist species.
It is thought that milk evolved from secretory glands in the synapsid egg pouch which helped to protect parchment eggs, with moisture and antimicrobial secretions. In fact, lactose is thought to have come from mucus sugars, which are used to encapsulate and neutralize microbes in the body, "Because α-lactalbumin evolved from lysozyme before the division of amniotes into synapsids and sauropsids (see Figure Figure1),1), the capacity to produce lactose was an ancient trait that preceded its utility in milk synthesis"
Intro to synapsid and sauropsid precursors of lactose.