Line an 8- by 8-inch pan with heavy-duty foil, leaving an overhang on two sides to facilitate removal of bars; coat with vegetable cooking spray.
Finely grind wafers, sugar, and almonds in a food processor. Add butter and continue to process until well mixed. Turn mixture into prepared pan and tamp it down to form a solid crust; set aside.
Whisk sugar, cornstarch, and salt in a medium saucepan. Just before adding milk, whisk in egg yolks, and then turn heat to medium and vigorously whisk in milk. Continue to whisk until mixture boils and becomes thick pudding. Remove from heat; stir in vanilla and then coconut. Spread mixture over crust and set in freezer to cool and set quickly.
Meanwhile, melt chocolate and butter over low heat until just melted. When pudding layer has set, drizzle chocolate over it and spread to cover.
Cover and refrigerate (up to 2 days) until ready to serve. Using foil handles, remove bars from pan. Cut into 16 squares and serve.
Recipe by Three Many Cooks at https://threemanycooks.com/recipes/sweet-treats/nanaimo-bars/