Heat the oven to 450 degrees F and arrange a rack in the middle.
Combine mushrooms, 3 tablespoons oil, and rosemary on a baking sheet, season with salt and freshly ground black pepper and toss to coat. Place in oven and roast until mushrooms are shrunken, and browned about, 20 minutes. Drizzle with 1 tablespoon of the balsamic and toss to coat.
Scatter half of the Parmesan on the pizza. Discard rosemary and arrange mushrooms on top. Distribute ricotta on top of the mushrooms and top with remaining Parmesan and a drizzle of the olive oil. Bake until crust is browned and cheese is melted, about 20 minutes.
Meanwhile, heat a small frying pan over medium heat, and add remaining 1 tablespoon olive oil. When oil shimmers, add egg and fry until set, bubbly and brown on the edges, and the pan is almost dry. Carefully add remaining 3 tablespoons balsamic vinegar and reduce slightly. Place egg on top of pizza. Reduce the balsamic vinegar about 1 to 2 minutes more, until syrupy, then drizzle over pizza and serve.