Moderna Inc. has emerged as a biotech power — and a household name — thanks to its success developing a COVID-19 vaccine. But that outcome hides what happened along the way: The company came perilously close to being the biggest loser in the race for a COVID-19 vaccine.