Boil spaghetti 2 minutes less than package directions for al dente. Drain and toss with olive oil.
Brown beef or sausage in a skillet; drain fat. Add onion, cook 3 minutes; add garlic, cook 30 seconds. Add marinara and seasonings; simmer 5 minutes.
Whisk ricotta with egg and a pinch of salt until smooth.
Toss spaghetti with two-thirds of the sauce, reserving the rest.
Grease a 7-inch round cake pan. Layer: half the spaghetti, all the ricotta mixture, ½ cup mozzarella, ¼ cup Parmesan, remaining spaghetti, reserved sauce, remaining mozzarella, remaining Parmesan.
Preheat air fryer to 350°F for 3 minutes. Air fry for 12 minutes until cheese is deeply golden and edges bubble.
Rest 5 minutes. Garnish with parsley and serve.