Your social "identity" changes, depending on the situation, which makes a lot of sense. Humans are generally good at adapting to new situations, the surprising part is how quickly we can do it.
Here some of the research on the subject https://neurosciencenews.com/social-identity-psychology-20262/