The reason you don't connect a generator directly to the line is for that reason.....feeding 120 or 240v back on a line, thru a transformer, will step it up to whatever several thousand volts are on the other side of the transformer.
ALL grid tie inverters have to meet UL Standard 1741.....which means unless they 'sense' grid power is on to back feed TO, they shut down. This prevents back feeds that could harm someone down the line working on it. It also means if you have a pure, grid tie only wind or solar power system, when the grid goes down, you are down as well. But when the grid is up, AND the system is producing power, it flows either to the house first, if needed, or back thru the power company meter, out to the grid. It's quite seamless and easy to set up actually.
There are 'hybrid' inverters with battery backup that disconnect from the grid when grid is down, but have an internal transfer switch to allow the power being produced ( or from batteries ) to flow on to the home/etc. You also need a regular transfer switch in most cases, just like you would with a generator, to take your house circuits off the grid as well. That is the way I set my system up.