Spread spaghetti squash and onion in a large casserole dish. Coat with olive oil, salt, and pepper.
Bake in the preheated oven until tender, about 45 minutes. Mash.
Mix eggs, bread crumbs, heavy cream, goat cheese, feta cheese, and rosemary into the mashed mixture. Lay tomato slices on top. Sprinkle Parmesan cheese and black pepper on top.
Bake in the preheated oven until golden brown, about 45 minutes.