Active time: 30 minutes
Total time: 1 hour, 45 minutes
Halve shrimp lengthwise, then crosswise. In a medium bowl, toss shrimp with ¼ cup fish sauce, sugar, pepper, and shallots, cover and set aside at room temperature to marinate for 1 hour.
Pulse rice in a spice or coffee grinder until coarsely ground, about 10 seconds; set aside. Heat oil in a large pot over medium heat, add shrimp mixture, and cook, stirring frequently, until shrimp are pink and shallots are softened, 3 to 4 minutes.
Stir in rice, then gradually add 8 cups water, stirring constantly to avoid any clumps. Increase heat to medium-high and bring just to a boil. Reduce heat to medium-low and simmer, stirring often, until thickened and rice is tender, about 30 minutes.
Increase heat to medium-high, add peas, and cook until just tender, 3 to 4 minutes. Remove pot from the heat, stir in spinach (if using), cilantro, scallions, and fish sauce to taste and set aside to let cool for 5 minutes. Ladle into bowls and serve.