In general your change looks good, but there might be more scenarios where the DDC parameters might need to be passed to UnrealPak, e.g. the invocation in CreatePaks (that one is likely only relevant if IOStore is disabled).
I’ll create a bug report so we can fix this for the future.
As an alternative you could try passing in the “-DDC=XXX” option via the -AdditionalPakOptions BuildCookRun/UAT parameter. These options should be passed directly to UnrealPak (via GetCommonUnrealPakArguments()).