How was the man on the bike endangering the bus?
I don't think he was endangering it at all.
Many of us have done silly, retaliatory things like this, in the certain knowledge that it will annoy the person it's aimed at and there's little they can do about it. I did such things in my youth. I was lucky and always got away with it. I imagine the cyclist is young and is certain he will too.
Nobody was hurt, so we may feel we can discuss a potentially dangerous situatuion with some levity.
If we do allow some levity into our observations, we might think this: Perhaps the cyclist was annoyd or outraged by some earlier move by the bus driver. Perhaps he thought he'd teach him a lesson and get his blood pressure up a little. Perhaps he thought it was a win/win, as the bus driver could do nothing back to him - rather like making faces at a bigger boy while hiding behind teacher. The collapse of that hubris-rich card house of absolute certainty and that daft, juvenile belief that one has the right to impose one's own justice is quite fun to watch... if that is what it was. Perhaps it was not.
Perhaps the cyclist had some impairment or had a wasp up his nose or was distracted by a badger fighting a wolf. But if we had to bet, I think we'd all bet that he was ramping up some real or imagined personal dispute with the bus driver. And he lost that battle.
If the bus driver is prosecuted or disciplined by his employer, the cyclist might think his antics worth it and that the battle was lost but the war was won. Then he might grow up.