I guess you know what's onet.xml and and webtemp*.xml. For them who still doesn't know but struggles to grasp the concept: Easy to read the article "How the SharePoint is built"
For them who know :
If you look at webtemptsps.xml (out of the box webtemplate under 12\TEMPLATE\1033\XML) you will see that a MOSS collaboration portal uses the custom provision class which is really handy when you want to create a several sites from one click:
<Template Name="SPSPORTAL" ID="47">
<Configuration ID="0" Title="Collaboration Portal" Type="0" Hidden="FALSE" ImageUrl="/_layouts/1033/images/template_corp_intranet.png" Description="A starter site hierarchy for an intranet divisional portal. It includes a home page, a News site, a Site Directory, a Document Center, and a Search Center with Tabs. Typically, this site has nearly as many contributors as readers and is used to host team sites."
ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=184.108.40.206, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
RootWebOnly="TRUE" DisplayCategory="Publishing" VisibilityFeatureDependency="97A2485F-EF4B-401f-9167-FA4FE177C6F6">
Long story short - You can create a class inherited from SPWebProvisioningProvider and override Provision method to write you own logic how you want to create site. You still need to use the method spweb.ApplyWebTemplate inside the provision method. The only plus of using you own Provision provider - you can add your own additional logic.
- spweb.ApplyWebTemplate is asynchronous (you can refer to this post you want to resolve the issues related to this fact)
- make sure that you don't apply the web template from which the current provision takes place (it creates an infinite loop)
The more detailed explanation how to write custom Provision provider is here - SharePoint Site Provisioning
P.S. When you need to make sure that additional logic should take place after the site creation - use the stapling feature!