Cook the pasta one minute shy of al dente according to the package instructions. Remove from heat, drain, and place in a large bowl. Reserve some pasta water for the sauce.
Heat olive oil in a pan and saute the chopped onions until translucent.
Add butter. Once it has melted, whisk in flour and continue whisking until golden and bubbly; about a minute.
Gradually add in the milk and conitnue whisking until nice and smooth, takes about 2 minutes. Whisk in salt and pepper.
Whisk in grated cheese in three batches. Sauce should be nice and thick. If it is too thick, you can use some of the reserve pasta water.
Stir in the cooled pasta until combined and pasta is fully coated with the cheese sauce.