Fix potenital infinite recursion in changed_for_autosave?

When associations checked for autosave have a cycle, and
none of them is dirty then changed_for_autosave? will be an
infinite loop. We now remember if we're in the check and
will short circuit the recursion.

Fixes #7809, same fix as #7824
This code ```assert_equal false, @ship.changed_for_autosave?``` test the code in ensure that resets the flag. I'll look into it how complicated is it to test it via ```@ship.save!```