SQL design for hierarchical structure where parent unit should not exist without subunits
Are you saying that you have troubles with FOREIGN KEYs.  If so, don' t use them.

If you are saying that a POST exists briefly without any PAGEs, then put the generation of both the POST and the PAGEs inside a transaction (BEGIN...COMMIT).