There's actually a better, and MUCH EASIER, way.
Download and install TwistedMexi's BetterBuildBuy mod. You can find it on curseforge, MTS, or patreon for free. Curseforge is easiest imo. (Make sure you have the latest version and check for updates whenever there's a new patch)
Before you leave the lot with stacked items (or before leaving build mode), click on the drop (up??) menu on the right side of the build/buy catalogue. It's the menu that allows you to filter object results based on color, pack, etc. There should be a dropdown menu labeled "Better BuildBuy." Click on it. Now click on the box next to "deletion protection." Save and leave.
This will prevent stacked items from being deleted when you leave the lot/game/build mode. The box will NOT be checked when you return to the lot or build mode. You'll have to check it before leaving every time.
This can also protect stacked items from being deleted when you move walls, build new rooms, raise foundations, etc. Just click the box next to "deletion protection," move or build your walls, then uncheck the box. Note: you won't be able to delete items while this box is checked, so remember to uncheck it when your stacked items are no longer in danger.
You CAN use the red shelf to stack stuff instead of using slots, but that's going to be a pain in the butt.
(I realize this thread is a year old, but I stumbled on it while looking for a solution, so now that I found one, figured I'd leave it here for anyone else who stumbles in from google)