For the sauce: Heat the oil over medium-high heat in a heavy-bottomed medium saucepan. Add the garlic, ginger and onions and cook until soft, about 5 minutes. Add the pineapple chunks and habanero and cook for 1 minute. Add the pineapple juice and cook until it caramelizes slightly, about 3 minutes. Add the hoisin, ketchup, brown sugar, ancho powder, mustard, honey, soy sauce, star anise and cinnamon and cook until thickened, about 30 minutes.
Transfer the mixture to a blender and blend until smooth. Season with salt and pepper . Pour into a bowl and allow to cool to room temperature.
For the ribs: Stir together the paprika, dry mustard, ground ginger, star anise, allspice, salt, pepper and Thai chile flakes in a bowl. Rub the ribs on the top side, wrap in plastic wrap and refrigerate for at least 4 hours and up to 24 hours.
Preheat a charcoal grill with about 80 briquettes off to 1 side, or in a kamado-style ceramic charcoal cooker with the ceramic plate removed. Remove the ribs from the refrigerator 1 hour before grilling.
Combine 4 cups water, the soy sauce, ginger and garlic and divide between two heavy disposable pans.
If using a charcoal grill: Put one disposable pan of steaming liquid on the bottom grate of the grill on the opposite side of the coals. Put the top grate on and heat well. Put the ribs on the grill, top-side down, directly over the hot coals and cook until golden brown and a crust has formed, about 10 minutes. Move the ribs to the other side of the grill, over the liquid, and place the other disposable pan with steaming liquid next to them over the coals. Put the lid of the grill on and open the vents on top halfway. Cook until the ribs are tender and juicy, about 2 hours. Add water as necessary to prevent scorching, and coals to keep the internal temperature between 225 and 250 degrees F.
If using the kamado-style ceramic charcoal cooker: Remove the ceramic plate and heat the grill rack. Put the ribs on the grill, top-side down, directly over the hot coals and cook until golden brown and a crust has formed, about 10 minutes. Remove the ribs and rack and put in the ceramic plate. Put one disposable pan of steaming liquid on the plate, then return the rack and the ribs to the grill. Cover and cook until ribs are tender and juicy, about 2 hours. Add water as necessary to prevent scorching, and coals to keep the internal temperature between 225 and 250 degrees F.
If using charcoal, finish the ribs by moving them back over the hot coals and turning and basting with sauce for 15 to 20 minutes. If using the ceramic charcoal cooker, leave the plate in and brush liberally with sauce for 15 to 20 minutes before removing from the grill.
Combine the sesame seeds and sprinkle the tops of the ribs. Cut the ribs apart and put on a platter. Scatter the green onions over the top and serve.