Superfluid–Mott-insulator transition of ultracold superradiant bosons in a cavity