You're perfectly right: reactants already form molecules before the reaction, and their bonds must first be broken. So a reaction (here a combustion) produces heat if the new bonds are stronger than the initial ones.
For instance, O=O isn't as strong a bond as H-O-H, and H-H isn't that strong neither, so combustion into H2O releases much heat.
As opposed, N≡N is a very strong bond, so N2 is little reactive and combining it with other elements produces little heat, or even absorbs some.