Layers get flattened and/or merged in order to maintain appearance.
Most often layers or artwork which utilizes transparency in Illustrator (this includes any blending modes) will be flattened/merged with the layers below the transparency.
If you remove all transparency (and blending modes) from the Illustrator file you should get all layers in the export to Photoshop. You may then be able to adjust the Photoshop layers and add back blending modes/transparency where desired.
You also want to export to the same color mode your Illustrator document is in. i.e. Export a CMYK Illustrator file to CMYK Photoshop, don't mix color modes.
I'm not aware of a script for exporting with these restrictions in mind.