Preheat oven to 400F. Prebake piecrust 10 to 12 minutes. Let cool.
Reduce oven temperature to 350F. Place tofu or beans, milk or water, flour, nutritional yeast flakes, salt, nutmeg, turmeric, and pepper in a blender or food processor and process several minutes until mixture is completely smooth. Stop machine frequently to stir mixture and scrape down the sides of the container. Set aside.
Heat oil in a medium skillet over medium-high heat. When hot, add onion and saute until tender and golden, about 8 minutes. Stir into blended mixture and pour into prepared piecrust. Bake on center rack of oven until top is firm, browned, and slightly puffed, about 40 to 45 minutes. Let rest 15 minutes before slicing.