Formation of foreland rifts