Cook onion in butter in a large skillet over medium-low heat, 30 to 35 minutes or until onion is caramelized, stirring often. Stir in salt and pepper; set aside.
Unfold piecrust and roll into a 14" circle on a lightly floured surface. Transfer to a parchment paper-lined baking sheet.
Combine pear slices and flour; toss gently to coat.
Spread three-fourths of onion over piecrust, leaving a 4" border around edges. Arrange pear slices over onion; top with remaining onion, pecans, and cheese. Fold over 4" borders of dough, pressing gently to seal. Brush dough with beaten egg.
Bake at 425° for 24 to 25 minutes or until golden, shielding with aluminum foil, if necessary, to prevent excessive browning. Cool on baking sheet on a wire rack 5 minutes. Serve warm, or cool to room temperature on wire rack.