> I thought ECC didn't use the same mathematical foundations of RSA

It kinda does, it just uses them differently

The basis here is the discrete inverse logarithm in a specific group (elliptic curves over rationals or multiplicative group module n)