You can do that in a Java action
No, Mendix is statically typed. Meaning you have to define entities it in your development environment.
Alternatively you could create a more abstract data model with an Object and Attribute entity.
This however would introduce a considerable amount of overhead when processing them.
Is there a specific reason you want to define them in runtime?
What is the use case for this?
Using the model SDK you could create a domain model.
Though it wouldn’t make sense if you want a user to create an entity and consume it in the same application.
Because database, pages, logic and pretty much everything is tied to it as well.