Basic principle of Drupal 8 Development.

Altering and extending Drupal without hacking core through plugins, hooks, and events. If you break this rule then you will be in wrong path, as altering core is not allowed in Drupal. Even directly altering contributed modules are not allowed.

For your expected result you may create a custom module and use the Render API to present content for display.

Now Drupal comes with services, dependency injection, and the service container.

You can use all third party PHP libraries in your application by following PSR standard.