Lawsuit argues layoffs should be based on merit, not seniority, while union says that would leave schools vulnerable to politics