Update the load path when an application is defined

Hello,

As per the `#add_lib_to_load_path!`'s documentation, this method should be called any time an application inherits from Rails::Application.

I'm not sure whether the test is in the right place and if it's written the good way but let me know if anything should be changed.

Fixes #17106.

Have a nice day.