Cell-state transitions and collective cell movement generate an endoderm-like region in gastruloids