Pimento Pineapple Casserole

4 tablespoons unsalted butter, plus more for greasing pan
1½ cups cornbread crumbs, reserving some for topping
1/3 cup mayonnaise
1/4 cup jarred pimentos, drained and chopped
2 tablespoons sweet onion, coarsely grated
1 pickled jalapeño, seeded and finely chopped
1/2 pound good-quality sharp yellow cheddar, coarsely grated (about 2 packed cups)
1/8 teaspoon
1/8 teaspoon ground white pepper
1 cup sugar
1/4 cup all-purpose flour, plus 3 tablespoons
2 cans 20-ounce crushed pineapple in natural juice, drained

Preheat oven to 350°F.
Lightly butter a 9-inch square or round baking dish or pan.
On a large rimmed baking sheet, arrange most of the cornbread crumbs and toast and place in oven, stirring halfway through, until dried and golden brown, 8 to 10 minutes.
Meanwhile, in a small pot, heat butter over medium heat until the solids are golden brown and the butter has a nutty fragrance, about 5 minutes.
In a medium bowl, carefully toss together cornbread crumbs and butter; set aside.
In another medium bowl, stir together mayonnaise, pimentos, onion and jalapeño. Add cheese, cayenne and white pepper, and stir again until combined.
In a large bowl, stir together sugar and flour until very well incorporated, then fold in pimento cheese mixture.
Put pineapple in a fine sieve, working in batches if needed, and press to remove as much juice as possible. Add pineapple to pimento cheese mixture and stir until combined.
Transfer to prepared pan, scatter with reserved cornbread crumbs and bake until browned on top and bubbly, about 25 minutes.