If so, can I block all third-party app wakelocks since I want the apps to run only when my screen is on?
I understand that this would break some functionality like receiving whatsapp messages when screen is off, but I am fine with it.
Are wakelocks only when screen is off?
No
Quoting from Android Developers
A wake lock is a mechanism to indicate that your application needs to have the device stay on
The following wake lock levels are defined, with varying effects on system power. These levels are mutually exclusive - you may only specify one of them.
I want the apps to run only when my screen is on?
This should be possible using automation but I haven't tried. Another alternative is using a task killer like [root] Servicely to choose and selectively kill apps when the screen is on.
Note: Task killers are not recommended for reasons mentioned here Do I really need to install a task manager? and various other answers in task-management tag
For further reading: Wakelocks: Detect No-Sleep Issues in Android* Applications