Yes cake can be baked in Pyrex.
Pyrex is safe to bake food including cake in the oven and the cake should come out just fine.
I use my Pyrex dishes to bake cakes and brownies and for even baking chicken and other meats in.
Pyrex is very versatile and is made to withstand the temperatures of an oven.
Just don't put the hot Pyrex directly from hot to cold otherwise it could shatter.
But allowing the Pyrex to cool before refrigerating it or freezing it will prevent it from shattering.
But Pyrex is safe to use in the oven and can withstand temperatures of 932 F and any temperature after 932 F the Pyrex could shatter.
But ovens at home don't typically heat up to that temperature so you won't be getting the Pyrex hot enough for it to shatter.