Avoid missing module error on namespaced controller and helper

Because the generators create namespaced controllers and helpers in only one line instead of explicitely specifying the module, it can lead to missing models errors.

    class Admin::WelcomeController < ApplicationController; end

The `Admin` module is expected to exist.

[ActiveRecord](https://github.com/rails/rails/blob/master/activerecord/lib/rails/generators/active_record/model/model_generator.rb#L28) already does this, in order to set the `table_name_prefix`.
This adds a similar behavior to controllers and helpers.

See #10679 for the original bug report.