How can we find the id of the parent form in preprocess_HOOK() or HOOK_alter() theme functions?
Not directly, but you can do it in two steps. In a form alter, set whatever information you need on the element where you later need it.

I'd suggest do use some sort of prefix, like #project_form_id = ABC

That should then be available in the preprocess/suggestions hooks.