A categorical approach to the h-principle