Technically yes, you can, but you shouldn't because in order for you to do so you'd have to give an external app, like Tasker, access to dangerous permissions (
android.permission.WRITE_SECURE_SETTINGS). Those permissions would give that app access to change tons of settings, not just the always on display setting (
DOZE_ALWAYS_ON). Also, you'd have to use ADB, which is extremely discouraged by GrapheneOS staff and many in the community, but if you choose to ignore their advice and you know what you're doing I've already given you all the information you'd need.
I personally missed that feature too when I switched to GrapheneOS, but I don't care anymore because my phone is always charging overnight anyway.