Preheat oven to 375 degrees Fahrenheit and grease a nine-by-thirteen-inch metal baking pan with melted butter.
Heat olive oil in a skillet over medium heat and saute minced onion until translucent.
Add ground beef, allspice, cinnamon, salt, and black pepper, cooking until browned and crumbly.
Unroll phyllo pastry, keeping sheets covered with a damp kitchen towel to prevent drying.
Layer half the phyllo sheets in baking pan, brushing each sheet generously with melted butter.
Spread cooked spiced beef filling evenly over bottom phyllo pastry layers.
Layer remaining phyllo sheets on top, brushing each sheet with melted butter.
Score top phyllo layers into squares using a sharp knife before baking.
Whisk egg, milk, salt, and pepper together, pouring custard evenly over scored pie.
Bake at 375 degrees for twenty-five minutes until pastry puffs golden brown and crispy.