Peel and cut the potatoes into ¼-inch-thick rounds. Place in a pot of boiling water and cook until fork tender. Drain off the water and set aside.
Preheat an oven to 350°F. Place a large saucepan over medium heat and drizzle in the olive oil. Once hot add in the onions and sauté until translucent.
Now add the butter to the pan and stir in the garlic, letting it cook for 30 seconds. Finally, whisk in the flour to make a roux.
Slowly pour in the chicken stock, whisking constantly to prevent any clumps from forming. Continue whisking until the sauce begins to thicken. Next, add the cheese and keep whisking until it has fully melted into the sauce.
Gradually whisk in the milk until it's completely incorporated. Season with salt and pepper to taste, then turn off the heat. Adjust the seasonings if needed.
Layer half of the cooked potatoes in a 9x9 baking dish, arranging them evenly. Drizzle half of the cheese sauce over the potatoes. Layer the remaining potatoes and cheese sauce. Sprinkle an additional ½ to 1 cup of shredded cheese on top, if desired.
Cover the dish and bake for 30 minutes. Then, uncover and continue baking for an additional 10 minutes. Enjoy!