For a long time, both Valjean and Cosette lacked anyone or anything to love, and they were not loved by anyone in return. Cosette would eventually become everything to Valjean, a circumstance that would ultimately have consequences. But for now, he is learning how to love her: “When he saw Cosette, when he had taken possession of her, carried her off, and delivered her, he felt his heart moved within him… Poor old man, with a perfectly new heart!”
Cosette, still a child, is more adaptable, but it's heartbreaking how her attempts to love those around her were often met with rejection. “She had loved the dog, and he had died, after which nothing and nobody would have anything to do with her.” So, she sincerely loved Valjean. It’s such good luck (destiny, Hugo says) that they found each other.
They have their happy moments — Cosette doing her things, singing, playing, laughing, and Valjean looks at her with adoration, kisses her “tiny red hand, all cracked with chilblains.” (Uh, no, child’s hand shouldn’t be like that. It’s so sad.) He also takes on the role of her educator, teaching her to read, which aligns with Hugo's ideal of childhood education. Interestingly, I had forgotten that Valjean himself initially learned to read while in prison, with the intention to harm the society.
Together, they form a perfect family dynamic: “He protected her, and she strengthened him. Thanks to him, she could walk through life; thanks to her, he could continue in virtue. He was that child’s stay, and she was his prop.”