If you're looking to completely disable folding (i.e. open all folds) while typing, see D. Ben Knoble's answer.
If you'd just like to prevent Vim from opening and closing folds based on syntax while typing, leaving closed folds closed, check out Vim tip "Keep folds closed while inserting text" or the FastFold plugin. These use a variation on that theme ...
Sure, just disable folding in insert mode, and restore it when you leave:
au InsertEnter * let w:oldfen = &l:foldenable \| set nofoldenable
au InsertLeave *
\ if exists('w:oldfen')
\ let &l:foldenable = w:oldfen
\ unlet w:oldfen