Is there a reliable way to determine how long it took the optimizer to generate a query plan?
There are many ways :


If you can run the query 


you can use set statistics time on which will give you:


  SQL Server parse and compile time: 
  CPU time = xx ms, elapsed time = xx ms.


If you cant run the query, then mine the plan cache to check for query compile time along with many other significant insights.


There are many other ways like profiler, server side trace or XEvents - but they are expensive and might have negative perf impact on your sql server.

You can use sp_BlitzCache to find out Query Compilation Timeout from plan cache.