Cook spaghetti in a large pot of boiling salted water until tender but firm. Drain and refresh with cold water.
Heat oil in a large nonstick skillet over medium heat. Add bacon and cook until browned. Add onions and cook, stirring occasionally, until golden, 10 to 12 minutes. Add garlic and cook until fragrant, about 1 minute. Transfer mixture to a small bowl and let cool slightly. Wipe out pan.
Whisk together eggs, ricotta cheese and milk in a large bowl. Stir in the onions, Parmesan, parsley, basil, salt and pepper. Add spaghetti and mix all ingredients together.
Add a thin layer of olive oil to coat pan and place over medium heat. Pour in mixture and distribute evenly in pan.
Cook until underside is golden, moving pan around on burner to ensure even cooking, about 6 minutes. Invert a large platter over skillet, grasp platter and skillet with oven mitts and carefully turn over. Lift off skillet and re-coat pan with a small amount of olive oil.
Slide mixture back into the skillet and cook until bottom is golden, cover and allow the pie to cook all the way through till firm inside.
Slide spaghetti pie onto a platter.