Implement proposal 298-canonical-families.txt

This will improve the performance of #27359 (moved) by making more family lines match.