A man has been shot dead by police after stabbing an officer in Perth’s south-eastern suburb of Gosnells.