For the base, melt the butter in a saucepan, stir in the flour and cook for a few mins, stirring all the time. Now, using a whisk or spatula, carefully stir in the milk, a little at a time, making sure the sauce stays smooth. Bring the mixture to a simmer and cook for a couple of mins until it thickens – it will be very thick. Turn the heat right down and keep cooking for 5 mins, stirring often.
Meanwhile, heat the oil in a non-stick frying pan and fry all of the chicken in batches until it starts to colour lightly at the edges. Scoop out each batch of chicken and put it on a plate. Add the onion to the pan if you are using it, and cook over a low heat until soft. Add the chicken and any juices and the onion to the white sauce, fold it in and cook the mixture for a further 15 mins or until the chicken is cooked through. If you're making the base ahead of time, you can leave it to cool at this stage then freeze in an airtight container for up to a month. (Defrost fully before using in the next step.)
Cook the pasta following pack instructions. Put the leeks in a pan with a little water, cover and cook until very soft. Drain, then return to the pan with the courgette, pesto and soft cheese, stir everything together, add the chicken base and stir well, then heat until just bubbling. Add a splash of water if it’s very thick.
Stir the pasta into the chicken mixture and tip into a large baking dish. Sprinkle over the breadcrumbs and grill the top until it browns.