Oracle - Tracking events that lead to a deadlock
Deadlocks are automatically detected by the engine, and one of the statements will be rolled back.  You can find queries by examining alert.log file (it will have a reference to trace file where detailed deadlock information is stored). It's not gonna give you the full stack of queries per sessions that contribute to the deadlock though . 

The query you are using shows deadlock until it's resolved by the database.
You can try checking not just v$session.sql_id, but v$session.prev_sql_id (previous query executed within the session context). If you're running Enterprise Edition (and as far as I remember Diagnostic+Tuning Packs) you may examine v$active_session_history view.  

If you have an option to modify client applications that use the database, you can use DBMS_APPLICATION_INFO package to identify modules and actions that are being executed.