Does custom ROMs like Cyanogen need to interact with TouchWiz? I am running a nightly build of CyanogenMod on my Samsung Galaxy P1000. I have seen that it runs pretty slow and there are some very critical bugs. So does custom ROMs like Cyanogen need to interact with custom application frameworks like Samsung TouchWiz or any other proprietary closed source software ? 

Or does it remove TouchWiz during installation ?

If it did it would make sense for the bugs and the stutters.
Touchwiz is Samsung's proprietary UI/framework. So except Samsung stock and Samsung based ROMs, its not present anywhere else (unless manually ported).

Cyanogenmod doesn't use anything related to touchwiz. Nor does it need any of its components to run. So the problems you are facing are merely just bugs inside ROM/system.

And yes, by default cyanogenmod removes everything related to touchwiz including touchwiz framework.

Additional Info: Since you are using nightly, its supposed to have bugs. Nightly ROMs are basically those when a developer updates the ROM features regularly regardless of whether the feature is completely stable or not. These ROMs are basically for people who like to test features early.