It's innate behavior. <<<<short answer
C. It's not defensive. It's meant to trap food. Spiders are carnivores and they eat what they catch. Webs are sticky and their pray can't get away.
A. Webs are constructed out of different types of silk, depending on what the web is for. The only thing you can eliminate is C. The silk itself is attractive to the opposite sex so courtship is a possibility. After the spider reproduces, the egg can be placed in a very dense covering of silk.
A is the all encompassing answer to the 11 things webs their silk are used for by spiders.
A <<<< answer.