Correct, you cannot transfer with an illegal restriction. It is not an “absolute” right. Racial prejudice in land transactions has been illegal since 1866.
Dedicating land for use as a park is not illegal.
Being that parks exist, you can safely conclude that judges have supported such restrictions.
You can sell land with all the deed restrictions you want, but you can’t force the buyer to honor those restrictions. Land comes with a bundle of rights. One of those to legally use the land as you see fit.
“Dedicating land for use as a park is not illegal.”
Of course it’s not illegal. The buyer can choose to honor deed restrictions, but the buyer is not required to do so.