Often, in follow‐up studies, patients experience intermediate events, such as reinterventions or adverse events, which directly affect the shapes of their longitudinal profiles. Our work is motivated by two studies in which such intermediate events have been recorded during follow‐up. In both studies, we are interested in the change of the longitudinal evolutions after the occurrence of the intermediate event and in utilizing this information to improve the accuracy of dynamic prediction of their risk. To achieve so, we propose a flexible joint modeling framework for longitudinal and time‐to‐event data, which includes features of the intermediate event as time‐varying covariates in both the longitudinal and survival submodels. We consider a set of joint models that postulate different effects of the intermediate event in the longitudinal profile and the risk of the clinical endpoint, with different formulations for the association structure while allowing its functional form to change after the occurrence of the intermediate event. Based on these models, we derive dynamic predictions of conditional survival probabilities which are adaptive to different scenarios with respect to the occurrence of the intermediate event. We evaluate the predictive accuracy of these predictions with a simulation study using the time‐dependent area under the receiver operating characteristic curve and the expected prediction error adjusted to our setting. The results suggest that accounting for the changes in the longitudinal profiles and the instantaneous risk for the clinical endpoint is important, and improves the accuracy of the dynamic predictions.