A genericity theorem for algebraic stacks and essential dimension of hypersurfaces