Yes, It's expected behavior when access the Cosmos DB from service endpoint enabled VNet.
Here are two points in your question:
- The NSG can be associated with a subnet or network interface level. In this case, when an NSG is associated with a subnet, the rules apply to all resources connected to the subnet. If a subnet NSG has a matching rule that denies traffic, packets are dropped, even if a VM\NIC NSG has a matching rule that allows traffic. Read here1 and here2.

- When you enable a Cosmos DB as Service Endpoint in a VNet, it will extend your virtual network private address space and the identity of your VNet to the Azure services, over a direct connection. Traffic from your VNet to the Azure service always remains on the Microsoft Azure backbone network.
Today, Azure service traffic from a virtual network uses public IP addresses
as source IP addresses. With service endpoints, service traffic
switches to use virtual network private addresses as the source IP
addresses when accessing the Azure service from a virtual network.
This switch allows you to access the services without the need for
reserved, public IP addresses used in IP firewalls.
So, if you are accessing the Cosmos DB from a VNet, it will use the private IP address in that VNet to access the Azure Cosmos DB service. If you are accessing the Cosmos DB outside of Azure, you will be restrcited by the firewall IP address of the Cosmos DB.