Not only can this happen, it is expected that it will happen, and most modern approaches to mediation other than conditional process analysis take it as a given that this will occur and produce mediation estimands that account for this. For modern approaches to mediation, I recommend reading Imai et al. (2010) and Valeri and VanderWeele (2014).
These approaches define mediation estimands in terms of potential outcomes rather than model coefficients, which makes interpreting their results a different task from selecting the right model to use. With these approaches, you typically propose a model for the mediator given the treatment and confounders and a model for the outcome given the mediator, treatment, and confounders. Each of these models can be arbitrarily flexible, including nonlinearities and interactions as appropriate.
Imai, K., Keele, L., & Tingley, D. (2010). A general approach to causal mediation analysis. Psychological Methods, 15(4), 309–334. https://doi.org/10.1037/a0020761
Valeri, L., & VanderWeele, T. J. (2013). Mediation analysis allowing for exposure–mediator interactions and causal interpretation: Theoretical assumptions and implementation with SAS and SPSS macros. Psychological Methods, 18(2), 137–150. https://doi.org/10.1037/a0031034