So baking right after you finish kneading your dough is quite classic, but actually it's not a very good thing for two reasons:
1) The butter is often very soft, especially if the kneading was a bit long and heated the dough, which becomes very soft, and if there are additions in it (raisins for example) they will go to the bottom of the pan more easily. How to correct this? Put the dough in the fridge for at least 30 minutes.
2) The gluten contained in the flour (if there is any in your recipe) under the effect of kneading has started to structure itself and "stretches" the dough making it elastic, which is not interesting for a cake because it hinders the rising during baking. How to correct this? Let the dough rest for at least 20-30 minutes.
You will have understood, no need to rush: Knead your dough, put the bowl or the mixer bowl in the fridge for 30 minutes (this is often the opportunity to do a little washing up...) then only then put it in the oven.
Another option, once the dough is kneaded, put it in a mould, then put the mould in the fridge for 30 minutes. Bake then and only then.
To sum up: Before putting a cake in the oven, it is always best to leave it in the fridge for about 30 minutes, as your cake will rise better when baked. In baking, the cold is (almost always) your friend.