Preheat the oven to 375°F/180°C, and line an 8-inch square pan with parchment paper.
Make the black sesame filling: Toast the black sesame seeds in a dry pan over low heat for 2-3 minutes, stirring occasionally, until the seeds begin to crackle and smell fragrant. Transfer to a plate and allow to cool slightly. Place the toasted black sesame seeds and sugar in a food processor or blender and blend to the consistency of fine sand. Transfer to a bowl and stir in the salt and sesame paste (or tahini). Fold with a spatula until the mixture is fully combined and resembles a paste or thick peanut butter.
Make the niangao batter: In a mixing bowl, combine the glutinous rice flour, non-dairy milk, sugar, coconut oil, eggs or flax mixture, and vanilla extract. Whisk the batter until smooth.
Pour half of the batter (reserve the other half) into the parchment-lined baking pan. Using your fingers, evenly distribute the black sesame paste over the batter, in little dollops of filling. Carefully pour or drizzle the remaining half of the batter on top, covering the black sesame layer as much as you can.
Bake for 32 to 35 minutes, or until the surface and edges are golden brown and the center of the cake springs back when lightly pressed. If garnishing with dates, goji berries, or pumpkin seeds, wait until after 15 minutes before pressing them lightly on top.
Let the niangao cool thoroughly before cutting and serving.