Preheat oven to 350 degrees
Heat oil in a large heavy ovenproof pot (Dutch oven) over medium. Cook garlic, stirring until golden, about 4 minutes. Add onion, anchovies, and red pepper flakes and cook, stirring often until onion is translucent, about 5 minutes. Stir in tomato paste, stirring often, until slightly darkened, about 2 minutes. Add wine, bring to a boil and cook until almost completely evaporated, about 1 minute. Add tomatoes, breaking up with your hands, and their juices; add basil and oregano and stir to combine. Swirl 1-1/2 cups water into one tomato can, then other, rinse, and add to pot; season with salt. Transfer pot to oven; roast sauce, stirring halfway through, until thick and tomatoes are browned on top and around edges of pot, 2-21/2 hours. Let sauce cool slightly, pass through food mill or food processor, or buzz with immersion blender.