Since you are overriding the AfterBuild taret it will always execute after the build occurs. This is the case for a rebuild or a normal build. If you want to perform some actions after the rebuild (and not build) then you should extend the dependency property for the Rebuild target. So in your case to inject the targets after a rebuild occurs your project file should look something like:
<Project ...>
<!-- some content here -->
<Import Project="... Microsoft.Csharp.targets" />
<PropertyGroup>
<RebuildDependsOn>
$(RebuildDependsOn);
InstallUtil;
CopyPostBuildFiles
</RebuildDependsOn>
</PropertyGroup>
</Project>
This method extends the property which the Rebuild targets uses to declare what targets it depends on. I've detailed this in the article Inside MSBuild, see section Extending the build process.
Also what you are trying to accomplish may be acheived by the AfterBuild target if you can specify what what files would "*trigger*" an update to occur. In other words you can specify a set of "inputs" into the target and a set of "outputs" which are both files. If all outputs were created after all inputs then the target would be considerd up to date and skipped. this concept is known as Incremental Building and I've coverd it in the article MSBuild Best Practices Part 2. Also I have detailed this in my book, Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build.
EDIT: Adding BuildDependsOn example
If you want the target to only execute when the files are actually built and not just when the Rebuild target is executed. Then you should create your project to be like the following:
<Project ...>
<!-- some content here -->
<Import Project="... Microsoft.Csharp.targets" />
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
CustomAfterBuild;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CustomAfterBuild" Inputs="$(MSBuildAllProjects);
@(Compile);
@(_CoreCompileResourceInputs);
$(ApplicationIcon);
$(AssemblyOriginatorKeyFile);
@(ReferencePath);
@(CompiledLicenseFile);
@(EmbeddedDocumentation);
$(Win32Resource);
$(Win32Manifest);
@(CustomAdditionalCompileInputs)"
Outputs="@(DocFileItem);
@(IntermediateAssembly);
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)">
<!-- Content here -->
</Target>
</Project>
I just copied the inputs and outputs from the CoreCompile target inside of Microsoft.CSharp.targets (*I'm assuming your are using C# here*) and pasted it here. What this means is that the target will be skipped whenever the CoreCompile target is executed. Also since I extended the BuildDependsOn we know that MSBuild will try and execute it whenever the project is built.