Place onion and 3 cloves of garlic in a food processor. Process while drizzling in 4 tablespoons olive oil, until smooth. Set aside.
Heat a large frying pan over medium-high heat and stir in the sausage. Cook and stir until the sausage is crumbly, evenly browned, and no longer pink, about 10 minutes. Drain and discard any excess grease. Stir in onion mixture, reduce heat to medium, and cook, stirring occasionally, for 5 minutes. Remove from heat. Pour mixture into the food processor along with the ricotta cheese. Process until smooth, streaming more olive oil as necessary. Stir in paprika and cayenne, and season with salt and pepper to taste.
Spoon about 1 tablespoon full of the sausage mixture onto the centre of one lasagne sheet. Brush the edges of the sheet with the egg, then fold into a triangle, sealing the edges tightly. Place ravioli on a baking tray lined with greaseproof paper. Repeat until all the lasagne sheets have been filled. Cover and refrigerate the ravioli until ready to cook.
Meanwhile, place the basil and pine nuts in a clean food processor. Pulse 4 or 5 times, then add 2 garlic cloves. Pulse 2 or 3 more times, then process until smooth while slowly adding in 5 tablespoons of olive oil. Stir in the balsamic vinegar, and season to taste with salt and pepper.
Fill a large pot with lightly salted water and bring to a rolling boil. Once the water is boiling, stir in the ravioli. Cook uncovered, stirring occasionally, until the ravioli float to the top and the filling is hot, 3 to 4 minutes. Drain well in a colander set in the sink. Place ravioli in a large bowl and toss with 4 to 5 tablespoons of pesto.
To make smaller ravioli, you can cut the lasagne sheets in half or in quarters, depending on their size. You can also use fresh wonton wrappers instead of lasagne sheets for this recipe.