Tweak to structure when getting terms ordered by parent Closes #4729