Funny you made this thread because I had the exact same experience yesterday and was thinking about this. Thankfully in my case the ship stayed above the base and didn't attack me, but it did blow up my parked ship. I was in an SRV and was going around the base picking them off and I was inside the base itself, at no point did the ship attack me. As for the Goliath, it glitched into the ground and didn't react to me. The ship (an anaconda) eventually attacked me as I drove away from the base (a large military fort).
Anyway, i was able to easily avoid the ships attacks (even on foot) and I actually called an Apex taxi which whisked me away.
On the flip side I find using a ship to attack ground forces is pretty bad, you can't lock on to on foot enemy and your attacks don't seem to damage them much. The only exception is rockets, they do kill on foot enemy but it has a very small kill radius. I think its made that way on purpose so you can't bomb the crap out of a base or level the enemy team when above an on foot conflict zone.