Cook and stir bacon and onions in a skillet over medium heat until bacon is crisp and onions are softened, 10 to 15 minutes. Add tomatoes to skillet; cook and stir until liquid is evaporated, 5 to 10 minutes. Bring a large pot of lightly salted water to a boil. Cook elbow macaroni in the boiling water, stirring occasionally until cooked through but firm to the bite, 8 minutes. Drain and return pasta to pot. Preheat oven to 355 degrees F (180 degrees C). Stir 3 cups Cheddar cheese into the tomato mixture until cheese is melted and sauce is thickened, about 5 minutes. Mix sauce into pasta. Pour pasta mixture into a 9x13-inch baking dish and top with remaining Cheddar cheese and mozzarella cheese. Bake in the preheated oven until cheese is golden brown and crisp, about 15 minutes.