Mexican President Andrés Manuel López Obrador is pursuing his plan to replace the country's federal judiciary with elected judges and magistrates before he steps down on Sept. 1—a move that has the legal sector and investors on edge.