How can I avoid different windows of the same app get folded in at the dock?
The dock does not shows the windows but the applications.

But once you choose an application you can switch among windows with command+`

To see all the open windows you can use exposé: press F10 to show all the windows of the current application or F9 for all the windows. You can also configure a gesture in the system preferences.