Question: do you need a passport before you book a flight?
Answer: No, you don't. You can buy the ticket. You will need to include the passport details as soon as they are available, and apply for ESTA in good time if that is applicable. But as long as everything is in order before you fly, it's fine to book the tickets now and provide passport details later.