In real life, ATC will clear you for a departure, arrival or approach procedure which means you will have to adhere to any restrictions present. If ATC clears you to a different altitude than that published, this should take priority over the altitude restriction and you should delete this constraint from the flight plan in order to continue using managed mode / VNAV. You could be either unrestricted completely or still need to climb / descent “via” the published procedure for the remainder if the waypoints.
Not sure how it is in MSFS, I noticed the built-in ATC clears you for every new altitude and speed restriction step by step, which isn’t how its done in real life as they are part of the procedure you are cleared for. Usually those restrictions are “at or above” which means if you fly a 3 degree descent path all the way to the FAF or FAP or climb using a normal rate in a departure situation you won’t “hit” any of those before reaching the ATC cleared altitude. I know in the London FIR there are some airports with departures or arrivals were they keep you low during departure or descent early and then fly level (“at” or “at or below”) to avoid other airspaces.