Ministers take legal advice over measure intended to clear way for quicker infrastructure and housing