Structure of the magnetic pileup boundary at Mars and Venus