That old axiom about how beggars can’t be choosers is so basic, even first-graders can understand it. But the people who run San Francisco’s public schools are apparently struggling with the concept.

In a school district with a big teacher shortage that reflects the national crisis but is made worse by the city’s insane housing prices and low salaries, there are 26 classrooms without a permanent teacher because the instructor got sick, left unexpectedly, or for some other surprise reason.

So when one of those classrooms finds an emergency fix the parents, kids and school staff are happy about, that’s reason to celebrate, right? Guess not.

First-graders at Glen Park Elementary on Monday met their 13th teacher of the year because the school district refuses to let the 12th one remain in the classroom. That’s because No. 12 is the daughter of the school’s principal, and the school board has a policy discouraging nepotism.

Sure, the policy makes a lot of sense when there are other teachers who want the job. But in this case, there aren’t.

“The most important thing is having a teacher who inspires the kids and cares about the kids, and she was seriously the best option,” said Emily Sims, a makeup artist and Miraloma Park resident whose son, Quintin Orozco, is in the class. “It’s just ridiculous that they’re pulling her out for no reason.”

The reason is based purely on hypotheticals, according to Myong Leigh, the district’s interim superintendent.

“Hypothetically, at least, it’s not hard to imagine there could be a situation in which a parent would have a concern about a teacher — it happens all the time. Where do they take that concern to?” he said, referring to the teacher’s boss being her mother.

He admitted, though, the decision is “not in response to any specific complaint or concern.”

Well, now he’s got plenty of specific complaints and concerns from parents who think 12 teachers is more than enough for one year. A group of them is expected to turn out at Tuesday’s Board of Education meeting to complain. (Full disclosure: I live in the neighborhood and am friends with some parents of children in the class, but have no kids enrolled there.)

The tale of the 13 teachers began in October when the classroom’s regular teacher experienced health issues and left abruptly. Ten substitutes followed, cycling in and out for a day or two.

All along, there was another option: Tess Robertson, a fully credentialed teacher who was working in the after-school program at Glen Park. Principal Jean Robertson, knowing the antinepotism rules, recused herself from a hiring committee composed of the school’s assistant principal, other staff and some parents of kids in the classroom.

They were only trying to hire a permanent substitute through the end of the school year — not a long-term employee for Glen Park. The committee posted the job, interviewed a whopping two candidates who expressed interest and determined Tess Robertson was the far better choice. She took over the classroom in November.

But this week, she’s leaving. Leigh told Jean Robertson her daughter couldn’t stay, despite the impartial hiring process. Left with no other choice, the principal moved the school’s reading specialist into the first-grade classroom, and the position of working one-on-one with kids school-wide who are struggling to read will remain empty.

“I wouldn’t rule it out, but so far it appears that we don’t have such a person on deck,” Leigh said.

Neither Robertson returned requests for comment, but by the accounts of several parents, the kids are distraught. One girl had written a story about the class in the fall and titled it, “The Class With 11 Teachers.” She just told her mom she’s going to have to rewrite it and call it, “The Class With 13 Teachers.”

Other parents said their children were finally happy and learning under Tess Robertson after developing stomach aches, crying at drop-off time, biting their nails or acting out in school and at home during the endless sub cycle.

Kendra O’Dwyer, a hairstylist who lives in the Excelsior, said she was surprised when her daughter, Aoife, 7, came home last week and said, “Miss Tess is leaving us now, too!”

“She says she hates school, that she doesn’t want to be there,” O’Dwyer said. “Last year, she loved going to school.”

While the nepotism angle adds a new wrinkle to the Glen Park situation, the problem of finding mid-year replacements for teachers who leave exists all over the city. There are now 620 active substitute teachers, fewer than in previous years. Subs make $156 to $189 daily depending on how often they work.

Full-time teachers in San Francisco aren’t well compensated either. A Chronicle investigation in May found that when it comes to average teacher pay, San Francisco’s public schools rank No. 528 out of 821 school districts in the state. After a pay boost this year, starting teachers in San Francisco with a bachelor’s degree and teaching credential earn $52,657. Of course, that goes almost nowhere in the city’s housing market.

“I call it a perfect storm of a national teacher shortage, an extremely high cost of living here in San Francisco and the Bay Area, and limitations on our funding from the state,” Leigh said. “Those things are definitely combining to create staffing challenges.”

Negotiations for a new teacher contract start next month, and Leigh said he’s hopeful teachers will get a raise. He added that the district is still planning to build teacher housing, though the search for usable land has taken years, and no site has yet been identified. He said the district is also trying to recruit and train more subs.

The antinepotism policy, passed by the school board long before the teacher shortage began, states “the district retains discretion in its enforcement of this policy.” But Leigh said there’s nothing about the Glen Park situation that merits discretion.

“I would say this case is typical of the risks that were imagined that led to the policy,” Leigh said. “It doesn’t seem like there are extenuating circumstances in this case.”

Tell that to the 7-year-olds who are on their 13th teacher.

San Francisco Chronicle columnist Heather Knight appears Tuesday and Friday. Email: hknight@sfchronicle.com Twitter: @hknightsf