Optional component with required component inside

Use a dynamic zone and have your component that has the required field as a component in this dynamic zone (as well as all other page components)

This should solve your validation issue, as the component if it’s not needed, just isn’t added to the dynamic zone by content editors.