Position oven rack in center of oven; preheat oven to broil.
Bring a large saucepan of water to a boil over high heat. Cook 2 (9-ounce) packages ravioli according to package directions; drain well.
Meanwhile, heat 1 tablespoon oil in a medium, high-sided ovenproof skillet over medium-high heat until shimmering.
Add 2½ cups mushrooms in an even layer; cook, undisturbed, until browned on the bottom, about 5 minutes.
Stir in 1 cup onion; cook, stirring occasionally, until the mushrooms are browned and the onions are softened, about 4 minutes.
Gradually stir in 5 cups baby spinach, 1 tablespoon garlic and ¼ teaspoon crushed red pepper; cook, stirring constantly, until the spinach is wilted, about 2 minutes. Transfer to a medium bowl. Wipe the skillet clean.
To the same skillet, add 1 (28-ounce) can crushed tomatoes, ¼ cup basil and ⅛ teaspoon salt; bring to a simmer over medium-high heat, stirring occasionally.
Remove from heat; stir in the cooked ravioli. Transfer to a separate medium bowl.
Spoon half of the ravioli mixture (about 3 cups) in an even layer in the bottom of the skillet.
Spoon half of the spinach mixture (about 1 cup) in an even layer over the ravioli mixture.
Repeat the layers once more with remaining ravioli mixture and spinach mixture.
Arrange ½ cup torn mozzarella in an even layer over the spinach mixture.
Broil until the cheese is melted and lightly browned, 3 to 5 minutes.
Let stand for 5 minutes before serving. Sprinkle with the remaining ⅛ teaspoon salt. Garnish with fresh basil leaves, if desired.
