Scientists have found that marsupials did not get to Australia until after the dinosaurs have been wiped out. Australia had drifted away from the rest of the world before marsupials evolved, and until marsupials migrated there from South America via Antarctica about 45 million years ago, the egg-laying monotremes were the only mammals found in Australia.
Live birth has evolved many different times among reptiles, and scientists who studied reptilian live birth suggest that it most often happened among reptiles that live in cold climates. The reason is that in a cold climates and/or northern latitudes, the eggs may not ever get warm enough to hatch or it takes so long because the day is so short and the summer so short that winter may arrive before the eggs can hatch. By carrying the eggs inside, a female can bask and keep her body and the eggs warm so they can hatch and/or hatch earlier, before the winter arrives.
Mammals are of course not ectotherms, and therefore they can incubate the eggs using their body warmth, without needing to retain the eggs inside the body, so live birth is not absolutely necessary. The Mesozoic was also very warm. Even the polar regions were ice free back then. Therefore cold climates were simply not the problem, except of course for the sudden cooling at the end of the Jurassic 145 million years ago, when lots of large dinosaurs and large pterosaurs became extinct. The earliest known marsupial may be 125 million years old, but it is possible, even more likely that live birth may have evolved a lot earlier than that. The first stage in the evolution of live birth is the retention of shelled eggs inside the female body and such an animal almost certainly did not have any characters we see in marsupials. Marsupial characters take time to evolve. 10-20 million years would be about the right amount needed.
Therefore my take is that mammals may have evolved live birth around the end of the Jurassic, some 20 million years or so before the earliest known marsupial. By retaining the eggs inside the body, the eggs may stay warm and may hatch reliably. This early marsupial is also about 4 inches long, which is noticeably larger than the earliest mammals. Large size is advantageous for mammals during a cold climate because the larger an animal, the smaller the amount of body surface in proportion to volume. That helps reduce heat lost to the environment for animals that generate their own body heat to stay warm, an advantage in the cool end of Jurassic climate. Also by being larger, larger eggs or more of them can be retained. Large size also allows the early marsupials to leave their underground retreats and roam around on the surface with less danger of being eaten by predators. The extinction of large dinosaurs perhaps made that easier also. In fact by the end of the Cretaceous, there were many marsupials that were large in North America, as large as a house cat, weighing about 11 lbs., with a skull length that is 4 inches. These marsupials were wiped out along with the dinosaurs when the giant meteor struck the earth 65 million years ago. Just like the dinosaurs, they had no place to hide from the oven like temperatures that were the result of the impact. The South American marsupials were wiped out as well. Only the marsupial shrews survived, because they found safe haven underground.
The platypus also survived in Australia because they were aquatic. Being in the water was the only other safe place besides being underground 65 million years ago.