Pen names are often used when the author writes in multiple genres so that readers can *distinguish* between them. Agatha Christie wrote her romance novels under the name Mary Westmacott.
As well, sometimes the writer's name just doesn't fit into what society expects for a writer of a particular genre-for example, men do not write romance novels. Actually they do. But a man's name on a harlequin romance won't sell. So you might write a romantic novel under a pen name if you are a man.
But you're right about another reason why people use pen names for separate genres. Sometimes the writer is famous as being a "serious" author-but he also writes "popular fiction." For example, Danial day Lewis's father is a poet lauriet (unsure of spelling). This is a high post. It is not appropriate for the main poet of a country to be writing (gasp!) detective novels-so he uses the pen name of Nicholas Blake.
The opposite could be true as well. A writer may start out as a pop fiction writer to make money but wants to be taken as a serious writer. A pen name might be necessary so that the public doesn't roll their eyes when they hear the news.