Heat oil in a large saucepan over medium heat. Add onion and garlic and cook, stirring, until softened, about 5 minutes. Set aside 1/4 cup of the onion mixture. Add flour to the onion mixture remaining in saucepan and cook, stirring constantly, for 1 minute. Gradually whisk in milk and return to a simmer; cook, whisking, until thickened to the consistency of heavy cream, 3 to 4 minutes. Remove from heat and season with salt and pepper. Spoon 1/2 cup of the sauce into bottom of the prepared baking dish. Set aside.