I'm not sure when they flattened. Before or after they went in the water?
In either case, the problem is probably the same. Bagels are little hand formed loaves. They need a lot of surface tension to hold their shapes and rise -- rather than just spread out.
This is how I form:
1. Divide into balls.
2. Pull the balls down
3. Put the balls down on the board, and use a finger to form a hole
4. Work the dough around the hole to form a bagel
6. Plunge in hot water, turn, remove
Obviously 1 through 4 are formation. It's steps 2, 4 that are tricky. On 2, you want to pull down enough to get a tight skin without totally flattening. On 4, try not to flatten at all. This isn't easy considering you're jamming a finger into the middle of a little ball of dough. In fact, it's not the gas in the dough you're trying to protect, it's the tightness of the outer surface. If you've baked batards you have a feeling for this.
On 6, you have to handle them very gently. I back one side with a short spatula, and slide a long spatula underneath to lift and take to the pot; then a spider to remove.