First hacky solution to fixing toplevel interactions, and tests.

Closes PR 14161.
Move code for top-interaction commands to their own file.

Also adds some more test cases.
Make top interaction handle module correctly.

Closes PR 14163.
Use actual original syntax.

Don't know how to test that this is better since I don't even know if it
is used.
Add approprite init calls.

Closes PR 13102.
Add newline in query-type/result.