Why energy is liberated in bonding?

Why energy is liberated in bonding?
So here is the reason:
When 2 electrons make bond they stop at a position. Before making a bond they are revolving but when they stop the energy they have is liberated.
So it is reason why energy is given out when electrons make bond.
*this is true somewhat, It is my own idea. This can be useful to teach students. Why energy is liberated?
If you have any query let me know in comments.