The solidity compiler does some "magic" when you include multiple files and do contract inheritance as is done in the ERC721 token contract. Ultimately it flattens the contract files into a single file and treats the inheritance and overridden functions in a deterministic way:
All function calls are virtual, which means that the most derived function is called, except when the contract name is explicitly given.
When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base contracts is copied into the created contract.
Here is what "most derived" means; take a look at the example from the docs about
Ultimately, the top level contract's function implementation will ALWAYS be the one called unless specified explicitly to be different.
Imagine this was not the case; it would be impossible to create wrapper contracts like this since a base contract would have no context that it is being wrapped, and thus would have no idea that it would need to call the "wrapped" version of a function rather than its own.
Thus we always call the "most derived" version of a function. Since we know the outer most contract always has context of the contracts it wraps, this pattern allows for exactly these scenarios where we are looking to extend the functionality of some base contract to do something more.