I'm sure there's a way to solve your problem with indexes. But you didn't show us your code that deletes the tasks nor your code that references the tasks. So we cannot help you with that.
Anyway, hiding the tasks is not the common way to solve this. There's built in task-hierarchy that you can use to solve the relation. Or you can just disable the tasks, instead of deleting them.
Making a "icon" task a subtask of the respective "engine" task.
[Tasks]
Name: "DesktopIcon"; Description: "{cm:CreateDesktopIcon} for the Launcher"
Name: "D3D"; Description: "Install D3D Engine"; GroupDescription: "Engines:"; Flags: checkablealone
Name: "D3D\DesktopIcon"; Description: "{cm:CreateDesktopIcon} for the D3D Engine"
Name: "GL"; Description: "Install OpenGL Engine"; GroupDescription: "Engines:"; Flags: unchecked checkablealone
Name: "GL\DesktopIcon"; Description: "{cm:CreateDesktopIcon} for the OpenGL Engine"
Name: "SW"; Description: "Install Software Engine"; GroupDescription: "Engines:"; Flags: unchecked checkablealone
Name: "SW\DesktopIcon"; Description: "{cm:CreateDesktopIcon} for the Software Engine"
This makes Inno Setup automatically uncheck the child "icon" task when the parent "engine" task is unchecked.
Note the checkablealone flag in engine tasks.

Disabling the "icon" task if the respective "engine" task is unchecked.
procedure UpdateIconTask(IconIndex: Integer; EngineIndex: Integer);
begin
WizardForm.TasksList.ItemEnabled[IconIndex] := WizardForm.TasksList.Checked[EngineIndex];
if not WizardForm.TasksList.Checked[EngineIndex] then
begin
WizardForm.TasksList.Checked[IconIndex] := False;
end;
end;
procedure UpdateIconTasks();
begin
UpdateIconTask(6, 1);
UpdateIconTask(7, 2);
UpdateIconTask(8, 3);
end;
procedure TasksListClickCheck(Sender: TObject);
begin
UpdateIconTasks();
end;
procedure InitializeWizard();
begin
WizardForm.TasksList.OnClickCheck := @TasksListClickCheck;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
begin
{ Initial update }
UpdateIconTasks();
end;
end;
In Inno Setup 6, instead of using indexes, you can also use task names with use of WizardIsTaskSelected and WizardSelectTasks.

{cm:CreateDesktopIcon} for the D3D Engine- You are combining localizable string with hard-coded string. That's not a good way. - Martin Prikryl