Phosphate extraction from sewage
The idea has been proposed by several journal articles and Wikipedia suggests that it is being done already. In &quot;Phosphate fertilizer from sewage sludge ash (SSA)&quot;, Franz proposes a method

whereby more than 90% of phosphorus can be extracted to make an adequate phosphate fertilizer

Also, the journal &quot;Phosphorus recycling in sewage treatment plants with
biological phosphorus removal&quot; by Heinzman lists three processes:

Krepo Process
Seaborne Process
Aqua Reci Process

In it Heinzman also mentions that

up to now no phosphorus recycling with a defrayal of costs is possible. The future importance of phosphorus recycling will depend on the market price for raw phosphate, the recycling costs and, furthermore, on the general political framework

So, it appears that it is cheaper to mine it than to recycle it. This may change in the future of course.