The legal age for getting married would be increased to 18 under a major overhaul proposed by SNP ministers.