Dosing Urea is typically perfectly safe for most aquariums. Urea, by itself, is not very toxic. Bacteria and plants both have the ability to convert Urea into NH4 using an enzyme called Urease.
If you add 1 ppm of urea to an established aquarium there is little to no chance of NH4 even being registered by a test kit, even hours after being dosed. Why is this?
Typically the bacteria that convert Urea to NH4 are located in the same areas as the bacteria converting NH4 to NO2 and NO3. The entire process happens in the same area, under the same conditions. So when Urea is converted to NH4, one could say it is almost instantly converted to nitrate.
However, when you dose Urea, some of that will be taken up by the plants where they can convert it into NH4 and CO2. It does not require the presence of nitrogen reducase (an enzyme that converts nitrate back NH4), so therefor it can bypass the typical nitrogen conversion process in a plant...just like NH4 can.
Just like nitrogen reductase needs molybdenum to function correctly, Urease needs nickle. Seachem trace has nickle in it, and I believe easylife profito does as well.
All things being equal, however, I would NOT dose Urea under the following conditions:
1) When a tank is still cycling, and I would wait a few weeks after the cycle is complete to make sure.
2) Under higher pH conditions (pH is 7.0 or more) where NH3 can be formed which is toxic to aquatic animal life. The risk here is still marginal in a well established tank, but I still would be weary.
3) Tanks that arn't kept clean, having dying animal tissue and plant matter abundantly present. Dosing Urea in an unclean tank can cause a proliferation of heterotrophic bacteria that clouds the water, and algae are known to thrive under similar conditions.
EDIT: On a side note, I would not use Urea-formaldehyde in an aquatic environment for many reasons. Traditional Urea is all that is needed.
To answer your question, "I wonder if the bacteria from the soil was the same bacteria which exist as part of the nitrogen cycle in the biological filtration or if these are something special for the soil/dirt?"
Yes, you are correct. The same bacteria is present in an aquarium's biological filtration...perhaps in even greater numbers per square cm than what would be found in typical agricultural soils.
Again, don't use Urea-formaldehyde!