Heat oil in a skillet over medium heat. Cook and stir onion in oil until tender. Add garlic; cook and stir until fragrant, 2 to 3 minutes. Stir in tomatoes and cook until tomatoes are warmed through. Toss the spaghetti squash with the vegetables, mozzarella cheese, olives, and basil. Serve warm.