As mentioned, ammonia is a good grease cutter. I wouldn't be too worried about its alkaline character vis-a-vis colorfast fabrics, as many laundry detergents are on the alkaline side, with sodium carbonat (washing soda) being quite alkaline.
Ammonia may be good for removing urine odors from fabrics because the odor causing chemicals in pet urine are not ammonia, they are probably various other organic compounds in the urine which the animals add to provide scent markers to declare their "territory".
To neutralize ammonia and other odors one can use baking soda powder or solution.
If the pet urine has gone deep into a carpet, it may have to be peeled back and cleaned from the underside, particularly if the padding gets soaked.
Ammonia is not recommended for use on wool or fur fabrics, as it will attack the keratin component of such materials. Similarly, it will cause skin irritation by a combination of its ability to strip skin oils from the tissue, drying it out, as well as its alkaline character.
Length of exposure is probably key. In a washing machine, the fabrics are exposed to an ammonia additive for less than an hour. On a carpet that is not cleaned soon enough, the pet urine will decompose into ammonia and then over time attack susceptible fibers.
Personally I don't like wall-to-wall carpets - too hard to keep clean.