Preheat oven to 375 degrees F. Grease 6 4-ounce ramekins with butter and dust with flour, shaking off the excess.
Make the Thai tea custard filling. Simmer 1 cup milk over low heat until warm. Add the Thai tea leaves and continue to simmer on low for 5 minutes. The milk should barely be bubbling. Turn off the heat and let the milk sit for 10 minutes. Strain, discarding the tea leaves.
Whisk the 2 egg yolks with sugar, a pinch of salt, and cornstarch until well combined. Slowly add the warm infused milk, whisking constantly. Pour the mixture back into the pot and bring to a simmer over medium-low heat. Continue to simmer until the custard thickens, whisking constantly. Remove from heat and transfer to a clean bowl. Place plastic wrap directly on top of the custard and let cool completely in the fridge until firm.
Make the coconut cake. Beat together the butter and coconut oil with sugar until light and fluffy, about 3 minutes. Add the eggs one at a time, making sure it's fully incorporated before adding the next egg. Add the vanilla, flour, baking soda, baking powder, salt, and coconut milk, mixing just until combined. Fold in the shredded sweetened coconut.
Fill the prepared ramekins about ¼ full with the coconut cake batter. Scoop 2 tablespoons of the Thai tea custard in the center and fill the ramekin about ¾ full with more coconut cake batter, making sure to completely cover the custard.
Bake the Thai tea molten cakes for 15-17 minutes or until the cake is golden brown and the edges have fully set. The center will be slightly jiggly. Remove the cakes from the oven and carefully invert them onto plates. Top with toasted coconut and powdered sugar if desired. Serve warm.