This is an example of "role playing".
Role-playing refers to the changing of one's conduct to expect a part, either unknowingly to fill a social part, or intentionally to showcase an embraced part. According to the Oxford English Dictionary, it means as "the changing of one's conduct to satisfy a social part"