Is it possible to create custom post type inside another CPT?

As I understood you want to be able to add Students from the Teachers post type and assign them directly to the current teacher.

Is it impossible? I don’t think so but definitely not an easy task to pull off.
You are going to have to manually write all the code the outputs a form inside the Teachers post type and create a Student according to the data filled once the post is published/Updated or by ajax as a separate form inside the page. (And I am not sure how viable this is).

Unless each student have only one Teacher (and I doubt this is the case) you can use a repeater inside the Teachers CPT instead of another CPT for the Students.

I would suggest you stick to it as it is and just add each Teacher and Student from there own panel while having AFC field link them together as the amount of work needed to achieve this is not worth it.