Improve guard for Rake detection

Some extensions define the Rake module without loading Rake.