Prevent extensions from building in parallel

Building an extension requires changing the path so commands executed
via a subprocess will work correctly.  In order to prevent parallel
extension builds from changing each other's directory a mutex is
required.

Fixes #607