He said bye bye, because probably in other similar situations he heard that people said those words before leaving. So, he assimilates that he has to say bye bye, because his mother is taking her purse, which is an action made when they are leaving.
The process by which a legislator votes in favor of the legislation of other lawmakers in order to gain support for her own legislation is known as logrolling.