A Wigan toddler had “undoubtedly” started to develop pneumonia when she was sent home from hospital less than 24 hours before she died, a court heard.