Why are school teacher and bureaucrat traditionally such sought after jobs?

Two generations ago, they were the only jobs with pensions