Dome-shaped magnetic order competing with high-temperature superconductivity at high pressures in FeSe