Does there exist an internet-like peer-to-peer packet radio system?
units will connect automatically to nearest units of same system, and
  generate a routing table, and therefore you can send your message
  anywhere in the network, so that other units will relay your message
  forward until it reaches its destination.


What you are describing is a mesh network, or more specifically a wireless mesh network. So the short answer is yes, someone has done it already.

As others have pointed out, radio amateurs implemented this over 20 years ago in a system known as APRS. To use APRS on the amateur bands require one to be a licensed radio amateur however.

In the commercial space there are many companies offering mesh network devices such as Ruckus and Village Telco with their mesh potato for voice in the third world. Another vendor of low cost devices is Open Mesh.

For amateur radio, the latest incarnation for high speed mesh networking is HSMM-MESH -


  HSMM-MESH™ is a high speed, self discovering, self configuring, fault
  tolerant, wireless computer network that can run for days from a fully
  charged car battery, or indefinitely with the addition of a modest
  solar array or other supplemental power source. The focus is on
  emergency communications.
  
  In its current form it is built using the Linksys WRT54GL wireless
  router and operates on channels 1-6 of the 2.4GHz ISM band, which
  overlaps with the upper portion of the 13cm amateur radio band. Other
  platforms and bands may be supported as development resources permit.