In this paper we present the first identification of foreshock cavitons and the formation of spontaneous hot flow anomalies (SHFAs) with the Vlasiator global magnetospheric hybrid-Vlasov simulation code. In agreement with previous studies we show that cavitons evolve into SHFAs. In the presented run, this occurs very near the bow shock. We report on SHFAs surviving the shock crossing into the downstream region and show that the interaction of SHFAs with the bow shock can lead to the formation of a magnetosheath cavity, previously identified in observations and simulations. We report on the first identification of long-term local weakening and erosion of the bow shock, associated with a region of increased foreshock SHFA and caviton formation, and repeated shock crossings by them. We show that SHFAs are linked to an increase in suprathermal particle pitch-angle spreads. The realistic length scales in our simulation allow us to present a statistical study of global caviton and SHFA size distributions, and their comparable size distributions support the theory that SHFAs are formed from cavitons. Virtual spacecraft observations are shown to be in good agreement with observational studies.