Quasistationary solutions of self-gravitating scalar fields around black holes