Back up a tad - apples and oranges at play here.
Fish produce nitrogen-containing waste as part of of their normal metabolism, just as do cats and dogs and people. Land animals -cats and dogs and people - convert this nitrogenous waste to urea, as less toxic than ammonia, and excrete it as part of the urine. Fish do not need to do this, as they do not breathe air but water, passing blood and water near one another divided only by a thin mebrane in the gills. CO2 and ammonia diffuse out readily across the fish's gills, so their body ammonia does not ever get to toxic concentrations, it diffuses out too well.
Fish's solid waste refelcts what they ate - it their food contains phosphate, then they will absorb some, and excrete some. If their food contains nitrogen (protreins do), they will absorb some and excrete some. Ditto for the other nutrients. Proteins, phosphates, etc. passed out as soild waste do not directly dissolve to any great extent. Instead they are broken down/digested by bacteria, fungi, multiple bacterial & infusorial type organisms which will release ammonia, nitrite, nitrate,phosphate, multiple dissolved minerals into the water.
Ammonia is mostly released by the fish themselves, via their gills, as they usually represent the largest biomass in the tank releasing ammonia, but the bacterial contribution is not trivial at all. Phosphate dissolved in the tank water is normally from the food - eaten or uneaten - digested by microbes.
Different foods have different phosphate levels. Some specify.
Overfed tanks are likely to have readable phosphate levels, whether overstocked or not. Overstocked tanks may also have readable phosphate levels just from the larger amouts of food required.