How to create an Animator and Animation at runtime

As the question says I’m trying to create animations and animators at runtime during code execution.
I’ve tried
Animator anim=new Animator();
Animation animation = new Animation();
but checking the exposed variables via the editor I see that they are listed as null. trying to use them gives me a null reference exception.

so how would I make these components at runtime. Yes I do need an individual animator and animation per game object, and they must be procedurally generated due to how the game runs

gameObject.AddComponent();
gameObject.AddComponent();