Bring a large pot of salted water to a boil and stir in macaroni. Cook, stirring occasionally, until pasta is al dente. Drain in a colander and shake well.
While pasta is cooking, melt butter in a large saucepan over medium heat, add onion and cook, stirring, until softened, about 6 minutes. Stir together milk and cornstarch in a large cup; whisk into pot with onion and cook, whisking, until boiling. Continue to cook, whisking, until thickened, about 2 minutes. Stir in peas and salt.
Add cooked pasta to sauce and stir well. Sprinkle Cheddar and Parmesan on top and toss well. Season with pepper to taste.