The warning followed the announcement of Mojtaba Khamenei, a son of the late supreme leader, as Iran’s next ruler.