The word custard is generally traced to the old word crustade, a dish with a pastry crust. Egg custards baked in pastry are among the oldest English sweets.
The crust came first, in name at least.