Under gavelkind or primogeniture inheritance, is a dynasty member who is not a descendant allowed to inherit?
Yes, other non-descendents can inherit.
Think of it this way: they are a descendent of the previous holder of the title (the current ruler's parent), so they are already in line for the title. One brother inheriting doesn't remove the other's claim to the title, so the second brother is the first brother's heir, at least until the first brother has children. Then the second brother is still in line for the title, after the first brother's children.