The companies being bailed out are very large. Your example does not work because it presumes that bonuses are, or should be, tied to profitability or performance of the entire company.
Many companies wisely do not do this; rather they tie bonuses to the performance of business processes they are responsible for.
Suppose you work at a plumbing and carpentry business. You work for the plumbing division; an incompetent coworker works in the carpentry division. The coworker buys loads of wood for a client, but then lets it sit in the rain for too long and it rots. You have an employment contract that rewards you with a bonus for the performance in the plumbing business, which performs well. However, the loss of material causes the firm's overall profitability to turn to a loss, even though your division has reversed some of the damage of the carpentry division.
Should your bonus be reneged because of the carpenter?
Suppose you have a job offer at a competing plumbing business, and you decide that you will leave for that job if your current employer eliminates your bonus despite the contribution in profits you have made to the firm. Is the firm best served by eliminating your bonus?
Questions of bonuses for the CEO, presuming it was the CEO who presided over the disaster, are another matter: it's not clear why they should be rewarded by the board, given that they are ultimately responsible for all divisions.