They are imitating you
Kids learn to adapt and absorb quickly, especially certain behaviours from their parents, teachers, and elders. If they hear sarcasm or assertiveness at home, they might try to mirror it outside without realising that this might be disrespectful to people.