Folding is a pretty complicated mechanism (see another answer I gave about folds for a nuanced discussion of folding scanning).
In order to give a complete answer we will need to see what type of plugins you are loading when booting up an instance of vim.
I'd bet that there are a few plugins that are mucking with the default vim settings (
vim -u NONE should have reproduced this). Any plugin that changes the
foldmethod is a likely cause (I'd try to remove them 1 by 1 and see what causes the issue)
If you don't want to muck with your plugins at all I'd recommend manually tweaking the syntax + parsing settings and then open a test buffer to confirm your functionality. It can be a frustrating journey to get it to play nicely but with some relentless digging in
:help you should be able to wrangle the beast that is folding.