First, wash the yellow tomatoes thoroughly. Remove the cores and cut them into quarters. If you prefer a smoother sauce, peel the tomatoes by blanching them in boiling water for 1 minute, then transfer them to an ice bath. The skins should slip off easily.
In a large pot, heat the olive oil over medium heat. Add the chopped onion and cook until translucent, about 5 minutes. Add the minced garlic and cook for 2 minutes, stirring frequently to prevent burning.
Add the prepared yellow tomatoes to the pot. Stir in the salt, pepper, and sugar (if using). If using balsamic vinegar, pour it in now and let it simmer for a few minutes to reduce slightly. Bring the mixture to a boil, then reduce the heat to low and let it simmer for 30 minutes, stirring occasionally.
After the tomatoes have broken down and the sauce has thickened, use an immersion blender to puree it until smooth. Alternatively, transfer the sauce to a blender in batches. Be careful with hot liquids. If using a blender, return the sauce to the pot.
Stir in the chopped basil, dried oregano, grated Parmesan, mascarpone cheese, and red pepper flakes (if using). Let the sauce simmer for 10 minutes to let the flavors meld together.
Taste the sauce and adjust the seasoning if necessary. Add more salt, pepper, or herbs to your liking.