As you mentioned, whooping cough is caused by Bordetella pertussis. It proves to be a very stubborn diseases especially in children.
Why this cough lasts so long?
There could be many reasons.
Firstly, the bacteria attach themselves to the cells lining the airways and then gradually spread all over. The area of lungs and airway is quite large and it gives them all playground to multiple and have greater impact.
Secondly, it is a specialty of this bacterium that even if it is treated and terminated, the coughing remains for long term.
Bordetella pertussis bacteria affect the lining of the airways in some way to cause symptoms (mainly a cough) to continue for a long time after the bacteria have gone.
This could be due to the damage they made and the healing time our body requires. I may not deny the theory that affected area might have some residuals of the microorganisms that might be causing 'irritation' to the throat that ultimately produces coughing.