Drupal architecture is designed on the idea of core modules and contributed or custom modules. I won't get too deep here but to add new functionality you can plugin into the core functionality by adding modules.
You will find that some modules will depend on or require other modules. This makes the system powerful as it means there are a lot of modules out there you can use and if you need to you can then plugin into them to extend the functionality. Sometimes you will want to add the functionality as a submodule but sometimes you may want to modify the module and contribute back the improvement as a patch.
! One rule you're best to adhere to though is never to hack core as it will make updating your site more difficult.
Hack core is modifying the underlying code base to modify functionality and the output. It might seem like a quick win but in the end it will be costly as you won't be able to apply the security updates easily.
Personally I have only needed to patch core once in 10 years of using Drupal and the issue was a well documented edge case on Drupal.org. All it meant was, each time I updated Drupal I had to see if the patch was included and if not reapply the patch.
Drupal core is built on the same idea of being modular and even though you don't have to it is recommended to manage your site with Composer. Composer manages all the packages or libraries of code that builds Drupal core. Drupal uses other frameworks and packages for some functionality meaning you don't only have the Drupal community behind Drupal but also the great PHP community.
I should also mention that Drupal core technologies include jQuery and JavaScript so there is that whole ecosystem too.
That's about it for this section. The main takeaway is that Drupal is an additive system and there are plenty of modules available to plug in to add functionality.