Heat olive oil in a skillet over medium heat; cook and stir onions in the hot oil until softened, about 10 minutes. Stir in squash and garlic; season with salt. Cook squash mixture, stirring occasionally, until squash is slightly tender, about 10 minutes. Add water if mixture gets too dry. Transfer squash mixture to the prepared casserole dish.