Preheat the oven to 350 degrees F.
Heat the olive oil in a large high-sided skillet over medium heat. Add the beef and cook, breaking up the meat with a wooden spoon, until crumbled and lightly golden brown, about 4 minutes. Add the onion, bell pepper and a pinch of salt. Continue to cook, stirring occasionally, until the onion and pepper are softened, about 2 minutes more.
Stir in the pepperoni, oregano, crushed red pepper flakes and garlic and cook until the garlic is fragrant, about 1 minute. Stir in the rice, tomato sauce, sugar, 1 teaspoon salt and 3 ½ cups of water until evenly combined. Bring to a simmer, then cover with a tight-fitting lid and reduce the heat to low. Cook, stirring every 5 minutes or so to prevent sticking, until the rice is al dente and the liquid has mostly been absorbed, 16 to 18 minutes. Taste and adjust the seasoning with salt.
Sprinkle the mozzarella and Parmesan evenly over the rice, then top with the remaining pepperoni. Bake until the rice is completely tender and the cheese is fully melted and bubbling at the edges, about 10 minutes.
Turn on the broiler and broil until the pepperoni is crisp at the edges and the cheese is browned in spots, 1 to 2 minutes more. To serve, sprinkle with more oregano, crushed red pepper flakes, grated Parmesan and basil, if using.
