Automatically create vertices/edges where faces intersect?

I wanted to create a cube with a hole. I selected a face, inset it, and then pulled it through the cube. I thought it would make new edges when the faces intersect (then I was going to delete the unnecessary parts manually), but it did not. Is there an automatic way to create edges and vertices where faces intersect? Or is there no such feature, and I would have to manually create them?

There’s a tool, Face -> Intersect (Knife). Check the options after invoking it. It either intersects selection with unselected, or everything. Also check the separation mode.
But keep in mind that, with your particular case, you’d be creating “impossible” geometry, if you intend to keep that extruded portion.

Thanks for the answer. I tried that, but nothing happens except that “No intersections found” briefly appeared on the status bar.

I do not want to keep the extruded part. I just want to use the intersecting points to cut a hole inside the cube. Something like this (it was created from a plain so it may not be a cube).

Like I said, check the options after invoking the tool. If you select everything and do the Intersect (Knife), then you need to change Source to ‘Self-Intersect’. Since you don’t need the extra parts, then also set the Separate Mode to ‘All’. This way it will cut and split the geometry, though you’ll need to delete the remaining protrusion and square manually, then merge vertices.

It sees that I need to select the face that has the extruding thing first, and then apply the knife and choose “Selected/Unselected” in the small collapsed pop-up window on the left-bottom.