Did some searching, looks like pyrolysis can convert waste into biochar in way that eliminates pathogens:
https://www.susana.org/_resources/documents/default/2-1832-2...
>Complete elimination of pathogens from Human Solid Waste (HSW) is a priority of our biochar reactor. By heating an appropriate flow of input material to high temperatures above 450 C for about 15 minutes, the material thoroughly chars, causing a 100% elimination of pathogens.
Doesn't say anything about heavy metals or pharmaceuticals. In particular I don't know whether heat can denature or destroy birth control hormones like ethinylestradiol. If it's suspended in water, it can be removed through a reverse osmosis or activated charcoal filter. Maybe leaching before charring and filtering the runoff would help? Dunno.