One potential issue is that most portable generators in the US have an internal neutral bonding jumper, that once connected to the building electrical system, creates a parallel neutral return path through the grounding system.
Portable generators are not really intended for hard wire connection to premise wiring. Usually there is a procedure in the installation guide to lift that bonding jumper.