Only if you design it to. The phase locked loop would "listen" to the mains frequency and slew to match. Slew speed is simply a design parameter you can set to any value.
I’m pretty sure companies like Victron Energy already make these kinds of systems - combination solar inverters and battery chargers that have transfer switches to be able to seamlessly switch to UPS mode when the grid drops out but can still export excess energy when it’s up.
And that's for what you need to allow your inverter to handle this automatically (you might need another voltage sensing channel to sense the grid-side of this breaker).
Your UPS handles an order of magnitude (or more) less power than a whole-home solar installation.
None of these problems are intractable of course, but you are oversimplifying the problem a little.
One can get a UPS affordably that will power 1500 watts of continuous power. Being able to supply just that much, or twice that much, from solar panels in a grid-down scenario would be tremendously useful, even if it's not enough power to fire up my welder.
Just shut it down, flip the switch and restart. Everything else will just be prohibitively expensive because it needs to be very safe.
If you get the phase wrong then you'll either reduce the lifetime of your components or the components explode after the nearest power plant tries to pump all available power into your poor inverter.