Melt 2 tablespoons butter in a large skillet over medium heat. Add onions and stir to coat with butter. Cook 40 minutes, stirring every 5 minutes, until onions start to turn golden. Stir in water and vinegar to deglaze the pan. Season with salt and pepper, to taste. Let onions cool before using.
To make the dough, use a stand mixer and on medium speed, beat together the cream cheese and butter until creamy Then add Parmesan cheese and lemon zest and continue to mix until incorporated.
With the mixer on low speed, slowly add in the sifted flour and mix just until combined. Use a spatula to scrape the bottom of the bowl to make sure everything is incorporated. Turn the dough onto a well-floured surface and roll into a ball. Cut the ball in quarters and wrap each quarter in plastic wrap. Refrigerate for at least 30 minutes or in the freezer for 15 minutes.
For the filling, mix together the ricotta cheese and chopped herbs. Season with salt and pepper and set aside.
Preheat oven to 350F. Line baking sheets with parchment paper.
Take one dough-ball out of refrigerator (leaving others chilled until ready to use) and on a well-floured surface, roll it out using a floured rolling pin. Roll it out to about 9 inches in diameter. Use a round object (a cheesecake pan works well) and outline a circle then use a knife to cut a perfect circle. Save scraps to roll out later.
Spread 1/4 of the cheese mixture onto the dough in a thin layer, leaving a border. Spread 1/4 of the onion mixture over the cheese, leaving a border. Then cut the circle into 12 triangles (or 8 for larger rugelach).
Roll the rugelach by starting at the outer end of the triangle and roll in making a little crescent shape. Place all rugelach end side down on a lined baking sheet and brush tops with egg wash and sprinkle each rugelach with sea salt. Repeat with remaining dough and filling.
Bake 15-18 minutes until lightly brown. When done, remove from oven and allow to cool to room temperature.