A UK mosque was set ablaze with two people still inside in a suspected arson attack that police are treating as a hate crime.