Val was in two minds about Gary during Season 5, but she was very hurt when Olivia told her over the phone that Gary had just married Abby.
During Season 5, Val simply saw Ben as more reliable and dependable compared to Gary, especially once Gary had married Abby. Most women also want stability for their kids, and that would especially be the case with Val considering the history with Lucy. So Ben was more reliable and more dependable in Val's eyes, so she wanted Ben as the father of her kids at that time, but Val also loved Gary more than anyone. Even years later, Val insisted on Bobby and Betsy calling Gary "Uncle Gary", and Val showed her worst side when Gary said that he wanted to be a father to the kids, and she threw tantrums. It took some time before Val was fine with Gary being the father in every sense to Bobby and Betsy, a combination of Ben having been gone and seemingly never coming back, and Gary mostly maturing further. At that point, from Val's point of view, it was a question about whether Bobby and Betsy would have a dad at all, and Gary was there.