It's a little bit of all those.
Originally a foil was a foiled sword used in practice for rapier and other swords. This is where the misconception that modern foil is a descendant of those practice swords. The practice weapons for these weapons were blunted with the point turned down and would have been considerably heavier that even a small sword.
As gunpowder made armor obsolete, smaller thrusting swords became more and more popular. The small sword, of which the modern foil is a direct descendant, was a natural evolution from large bladed swords as swordsmen began favoring lighter, quicker thrusting weapons. Technique soon followed and the linear approach to fencing was born in order to capitalize on the ability to parry and attack with the same weapon (instead of opening the entire body up with the use of a parrying implement).
The conventions of foil were developed as a mix of what it takes to survive a duel, what was considered "proper" duelling technique, and what was considered safe to practice at a time when adequate protection was not available.
Here's a pic of 2 foils and an English small sword (plus a history).
http://www.saxonfc.fsnet.co.uk/foilhist.htm
Here's a glossary (with some pics) of swords.
http://www.georgehernandez.com/xMart...des/Swords.htm