"The default value can be thought of as modeling random access as 40 times slower than sequential, while expecting 90% of random reads to be cached
If you believe a 90% cache rate is an incorrect assumption for your workload, you can increase random_page_cost to better reflect the true cost of random storage reads. Correspondingly, if your data is likely to be completely in cache, such as when the database is smaller than the total server memory, decreasing random_page_cost can be appropriate. Storage that has a low random read cost relative to sequential, e.g. solid-state drives, might also be better modeled with a lower value for random_page_cost."
In other words, cache misses are taken into account to the extent that the model above is reflective of your workload and hw environment.