you could follow one if these approaches:
duplicate your spaceship and everything in it, but without the visible meshes. This "Ghostship" is stationary, so there are no issues with your player controller. The player movement and rotation relative to the ship must then be replicated into the visible ship.
Attach the player rigidbody to the spaceship rigidbody using a joint. Then grab all inputs from the player controller and manually move the player inside the ship.
Keep the ship stationary and move the universe instead
Ignore the Unity built-in physics controlling the rigidbodies and do it yourself, similar to kinematic player controllers.
For sure there are more solutions thinkable.
You could also check my asset on the Unity Asset store, which addresses exactly this problem.
https://assetstore.unity.com/packages/tools/physics/walk-inside-rigidbody-278159