Inspired by Arsalan Adam Khatri's answer I found a solution:
1) First create a page to handle the redirection:
LayoutPageRedirect.aspx
<html>
<head>
<META http-equiv="refresh" content="0;URL=./_layouts/folder/HomePageCustom.aspx">
</head>
</html>
2) Then create a module to deploy this file
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ModuleLayoutPageRedirect">
<File Path="ModuleLayoutPageRedirect\LayoutPageRedirect.aspx" Url="LayoutPageRedirect.aspx" />
</Module>
</Elements>
3) Then change the welcome page
SPFolder rootFolder = currentWeb.RootFolder;
string home = "LayoutPageRedirect.aspx";
rootFolder.WelcomePage = home;
rootFolder.Update();
4) Finally Test
Enter http://server/site/web
Automatically goes to:
http://server/site/web/LayoutPageRedirect.aspx
And redirected to:
http://server/site/web/_layouts/folder/HomePageCustom.aspx