Based on observing my dd4.8 ( so really limited sample size), I think children use imaginative play to understand the nuances of social interactions, understand deeply a new concept they have learnt and imagine new situations that they may or may not encounter in real life and of course, just for fun.
Dd has engaged in imaginative play for as long as I can remember and some if the characters she assumes are permanent fixtures that have been with us for more than a year and others that are created on an as needed basis. Dd enjoys playing pretend with adults and children alike. however, with adults, she can be the boss as adults tend to understand their exact role and will let her direct their words and actions. With children, she goes with the flow. While I enjoy watching her, I must admit that I am exhausted by the end of some of the crazy pretend days and I crave for normalcy, where I can be me and not in some elaborate role.