Slice all onions and leeks. Set one sliced onion aside for topping the baguette. Mince the garlic.
Remove the lid from the Instant Pot and press Sauté. Add 1 tablespoon butter. Once melted, add leeks and garlic with a pinch of salt and pepper. Sauté until softened and slightly translucent, about 5–7 minutes.
Use a slotted spoon to transfer to a large bowl. Set aside.
Add 2 tablespoons butter to the pot.
Add the four sliced onions and cook on Sauté, stirring often, until deeply caramelized and golden brown, about 30–35 minutes. Do not rush this; this is where the flavor lives.
Transfer onions to the bowl with leeks and garlic.
Add 3 tablespoons butter to the Instant Pot.
Once melted, whisk in 3 tablespoons of flour. Cook, whisking constantly, until the roux turns slightly darker than blond, about 10–12 minutes.
Gradually whisk in remaining salt and pepper (divided) and the Red wine, a little at a time, until smooth and lump-free.
Slowly pour in the beef stock, whisking constantly.
Return caramelized onions, leeks, and garlic to the pot. Add thyme and bay leaf if using.
Cancel Sauté.
Secure the lid and set to Pressure Cook (High) for 10 minutes.
Allow Natural Release for 10 minutes, then carefully Quick Release remaining pressure.
Remove thyme sprigs and bay leaf. Taste and adjust seasoning as needed.