The judges rejected the Polish government’s arguments, which included that traditional marriage is part of Poland’s heritage.