That is the point of the banter: to see how you handle stressful situations.
Women don't understand this, but nearly all men do.
Why? For every accident, there are around twenty near misses. For every near miss there are several situations that could have gone bad very quickly unless the person on the spot remains calm and acts rationally.
It is essential to know how you behave under stress in most blue collar work. They're not being assholes for fun; they're doing it to save lives.