Thousands of teachers would risk facing the sack over same-sex 'marriage'