Students from less wealthy backgrounds are more likely to attend schools where learning a foreign language to GCSE is considered optional – and not necessarily even encouraged – new research shows.