Defining the primary address of a CiviCRM contact
Webform-CiviCRM will always set the first address as "primary".

You don't need to expose the location-type field if you don't want to - you can set it on the backend form. This has the downside of forcing the location type of the primary address to change to whatever you've set the first address to.

Here is a solution that will solve your problem for both creating and updating contacts, and you don't need to resort to custom code and hooks:


Set the location-type field for both addresses to be exposed (user select)
Change both location-type webform fields to type "hidden"
Set the default value for the first one to be "home" and the other "work"


Now when the user updates their address, the location type will not be changed (your default values will be overwritten by the existing data). But when creating new addresses you'll be setting sensible defaults.